summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Branca <chewbranca@apache.org>2014-11-28 07:35:54 +0300
committerAlexander Shorin <kxepal@apache.org>2015-12-03 00:52:11 +0300
commitac9e22d006464428b378f1178604ab7490b95490 (patch)
tree5eae226964ec5d27dda1e961e40edcc1eb748737
parentfb7bf755f390a1fd78f3ed984a825c0fd51fb80c (diff)
downloadcouchdb-ac9e22d006464428b378f1178604ab7490b95490.tar.gz
Add ?assertNotMatch eunit macro for <R14B04
-rw-r--r--test/couchdb/include/couch_eunit.hrl.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/couchdb/include/couch_eunit.hrl.in b/test/couchdb/include/couch_eunit.hrl.in
index ff080e1f4..063b3dbb2 100644
--- a/test/couchdb/include/couch_eunit.hrl.in
+++ b/test/couchdb/include/couch_eunit.hrl.in
@@ -42,3 +42,23 @@
{A, B, C} = erlang:now(),
lists:flatten(io_lib:format("~p~p~p", [A, B, C]))
end).
+
+%% Borrowed from https://github.com/richcarl/eunit/blob/master/include/eunit.hrl#L200-L219
+%% TODO: get rid of this once R14* is no longer supported
+-ifndef(assertNotMatch).
+-define(assertNotMatch(Guard, Expr),
+ begin
+ ((fun () ->
+ __V = (Expr),
+ case __V of
+ Guard -> erlang:error({assertNotMatch_failed,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern, (??Guard)},
+ {value, __V}]});
+ _ -> ok
+ end
+ end)())
+ end).
+-endif.