diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-03-02 08:59:03 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-03-02 08:59:03 +0000 |
commit | 19a144f9f4be209b1e6d7480480b81c6e4a1dccc (patch) | |
tree | 331c6a00e29c6ff4a623d01587b2619dfbb072c5 /lib | |
parent | 1fa34cd0b80e90e9cfb493fd2f085310279ad4f9 (diff) |
Add convenience macro for testing commands that return errors.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backupstore/StoreTestUtils.h | 5 | ||||
-rwxr-xr-x | lib/server/makeprotocol.pl.in | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/backupstore/StoreTestUtils.h b/lib/backupstore/StoreTestUtils.h index 3365a7f4..d8655e63 100644 --- a/lib/backupstore/StoreTestUtils.h +++ b/lib/backupstore/StoreTestUtils.h @@ -75,5 +75,10 @@ bool create_account(int soft, int hard); //! Deletes the standard test account, for testing behaviour with no account. bool delete_account(); +#define TEST_COMMAND_RETURNS_ERROR(command, error) \ + TEST_CHECK_THROWS(command, ConnectionException, \ + Conn_Protocol_UnexpectedReply); \ + TEST_EQUAL(BackupProtocolError::error, protocol.GetLastErrorType()); + #endif // STORETESTUTILS__H diff --git a/lib/server/makeprotocol.pl.in b/lib/server/makeprotocol.pl.in index f90b5474..e02ac74c 100755 --- a/lib/server/makeprotocol.pl.in +++ b/lib/server/makeprotocol.pl.in @@ -532,6 +532,7 @@ public: virtual ~$client_server_base_class(); virtual std::auto_ptr<IOStream> ReceiveStream() = 0; bool GetLastError(int &rTypeOut, int &rSubTypeOut); + int GetLastErrorType() { return mLastErrorSubType; } protected: void SetLastError(int Type, int SubType) |