Add ?assertNotMatch eunit macro for <R14B04
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ac9e22d0 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ac9e22d0 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ac9e22d0 Branch: refs/heads/1.x.x Commit: ac9e22d006464428b378f1178604ab7490b95490 Parents: fb7bf75 Author: Russell Branca <[email protected]> Authored: Fri Nov 28 07:35:54 2014 +0300 Committer: Alexander Shorin <[email protected]> Committed: Thu Dec 3 00:52:11 2015 +0300 ---------------------------------------------------------------------- test/couchdb/include/couch_eunit.hrl.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/ac9e22d0/test/couchdb/include/couch_eunit.hrl.in ---------------------------------------------------------------------- diff --git a/test/couchdb/include/couch_eunit.hrl.in b/test/couchdb/include/couch_eunit.hrl.in index ff080e1..063b3db 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.
