aboutsummaryrefslogtreecommitdiff
path: root/test/suite.hrl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pawel@process-one.net>2015-04-09 16:39:52 +0200
committerPaweł Chmielowski <pawel@process-one.net>2015-04-09 16:39:52 +0200
commite8701802ee28cd8c8dfd4c182b93b60aca3eb22e (patch)
tree9716263387f2e3ac4b495c64034c95e79e407ddc /test/suite.hrl
parentShow received input and expected input in ?recv* macros in case of failure (diff)
Give better error messages for tests failing on #...{} = recv() lines
Diffstat (limited to '')
-rw-r--r--test/suite.hrl13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/suite.hrl b/test/suite.hrl
index 31e21ee5f..5463575a8 100644
--- a/test/suite.hrl
+++ b/test/suite.hrl
@@ -17,6 +17,15 @@
-define(EJABBERD_CT_URI, <<"http://www.process-one.net/en/ejabberd_ct/">>).
+-define(recv1(P1),
+ P1 = (fun() ->
+ V = recv(),
+ case V of
+ P1 -> V;
+ _ -> suite:match_failure([V], [??P1])
+ end
+ end)()).
+
-define(recv2(P1, P2),
(fun() ->
case {R1 = recv(), R2 = recv()} of
@@ -24,7 +33,9 @@
{P2, P1} -> {R2, R1};
{P1, V1} -> suite:match_failure([V1], [P2]);
{P2, V2} -> suite:match_failure([V2], [P1]);
- {V3, V4} -> suite:match_failure([V3, V4], [P1, P2])
+ {V3, P1} -> suite:match_failure([V3], [P2]);
+ {V4, P2} -> suite:match_failure([V4], [P1]);
+ {V5, V6} -> suite:match_failure([V5, V6], [P1, P2])
end
end)()).