summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/imapresource/tests/imapmailsynctest.cpp4
-rw-r--r--tests/testutils.h8
2 files changed, 10 insertions, 2 deletions
diff --git a/examples/imapresource/tests/imapmailsynctest.cpp b/examples/imapresource/tests/imapmailsynctest.cpp
index f20a77e..23bb4e5 100644
--- a/examples/imapresource/tests/imapmailsynctest.cpp
+++ b/examples/imapresource/tests/imapmailsynctest.cpp
@@ -95,8 +95,8 @@ protected:
95 QByteArray createMessage(const QStringList &folderPath, const QByteArray &message) Q_DECL_OVERRIDE 95 QByteArray createMessage(const QStringList &folderPath, const QByteArray &message) Q_DECL_OVERRIDE
96 { 96 {
97 Imap::ImapServerProxy imap("localhost", 993); 97 Imap::ImapServerProxy imap("localhost", 993);
98 imap.login("doe", "doe").exec().waitForFinished(); 98 VERIFYEXEC_RET(imap.login("doe", "doe"), {});
99 imap.append("INBOX." + folderPath.join('.'), message).exec().waitForFinished(); 99 VERIFYEXEC_RET(imap.append("INBOX." + folderPath.join('.'), message), {});
100 return "2:*"; 100 return "2:*";
101 } 101 }
102 102
diff --git a/tests/testutils.h b/tests/testutils.h
index f464e76..717f2ec 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -38,6 +38,14 @@ do {\
38 return;\ 38 return;\
39} while (0) 39} while (0)
40 40
41#define VERIFYEXEC_RET(statement, return) \
42do {\
43 auto result = statement.exec(); \
44 result.waitForFinished(); \
45 if (!QTest::qVerify(!result.errorCode(), #statement, "", __FILE__, __LINE__))\
46 return #return;\
47} while (0)
48
41#define VERIFYEXEC_FAIL(statement) \ 49#define VERIFYEXEC_FAIL(statement) \
42do {\ 50do {\
43 auto result = statement.exec(); \ 51 auto result = statement.exec(); \