[Box Backup-commit] COMMIT r3358 - in box/trunk: lib/backupstore test/bbackupd
subversion at boxbackup.org
subversion at boxbackup.org
Fri Aug 15 23:47:30 BST 2014
Author: chris
Date: 2014-08-15 23:47:30 +0100 (Fri, 15 Aug 2014)
New Revision: 3358
Modified:
box/trunk/lib/backupstore/StoreTestUtils.h
box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Add a TEST_PROTOCOL_ERROR_OR assertion.
Similar to TEST_COMMAND_RETURNS_ERROR_OR, but allows any command or sequence
to cause the error, without direct access to the command message.
Refactor so that TEST_COMMAND_RETURNS_ERROR_OR calls TEST_PROTOCOL_ERROR_OR
to make the assertion on the last error seen by the protocol.
Modified: box/trunk/lib/backupstore/StoreTestUtils.h
===================================================================
--- box/trunk/lib/backupstore/StoreTestUtils.h 2014-08-15 22:47:27 UTC (rev 3357)
+++ box/trunk/lib/backupstore/StoreTestUtils.h 2014-08-15 22:47:30 UTC (rev 3358)
@@ -80,10 +80,8 @@
//! Deletes the standard test account, for testing behaviour with no account.
bool delete_account();
-#define TEST_COMMAND_RETURNS_ERROR_OR(protocol, command, error, or_statements) \
+#define TEST_PROTOCOL_ERROR_OR(protocol, error, or_statements) \
{ \
- TEST_CHECK_THROWS_OR(protocol . command, ConnectionException, \
- Conn_Protocol_UnexpectedReply, or_statements); \
int type, subtype; \
protocol.GetLastError(type, subtype); \
if (type == BackupProtocolError::ErrorType) \
@@ -103,6 +101,11 @@
} \
}
+#define TEST_COMMAND_RETURNS_ERROR_OR(protocol, command, error, or_statements) \
+ TEST_CHECK_THROWS_OR(protocol . command, ConnectionException, \
+ Protocol_UnexpectedReply, or_statements); \
+ TEST_PROTOCOL_ERROR_OR(protocol, error, or_statements)
+
#define TEST_COMMAND_RETURNS_ERROR(protocol, command, error) \
TEST_COMMAND_RETURNS_ERROR_OR(protocol, command, error,)
Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp 2014-08-15 22:47:27 UTC (rev 3357)
+++ box/trunk/test/bbackupd/testbbackupd.cpp 2014-08-15 22:47:30 UTC (rev 3358)
@@ -883,6 +883,7 @@
TEST_CHECK_THROWS(ReadDirectory(*client, 0x12345678),
ConnectionException,
Protocol_UnexpectedReply);
+ TEST_PROTOCOL_ERROR_OR(*client, Err_DoesNotExist,);
}
client->QueryFinished();
More information about the Boxbackup-commit
mailing list