You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2015/06/29 22:27:00 UTC
couch commit: updated refs/heads/1805-reduce-collation to 306d2e2
Repository: couchdb-couch
Updated Branches:
refs/heads/1805-reduce-collation [created] 306d2e2df
Add a convenience macro for "equal to" test
This macro preserves the expressiveness of ?assertEqual but uses ==
instead of =:=. Useful for situations where the test involves numbers
that may be converted between types (e.g. 1 == 1.0).
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/306d2e2d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/306d2e2d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/306d2e2d
Branch: refs/heads/1805-reduce-collation
Commit: 306d2e2df54fa9406adf1022c4d250040b90e42a
Parents: 04312dc
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Mon Jun 29 16:24:32 2015 -0400
Committer: Adam Kocoloski <ad...@cloudant.com>
Committed: Mon Jun 29 16:24:32 2015 -0400
----------------------------------------------------------------------
include/couch_eunit.hrl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/306d2e2d/include/couch_eunit.hrl
----------------------------------------------------------------------
diff --git a/include/couch_eunit.hrl b/include/couch_eunit.hrl
index bd37ef9..7c23b50 100644
--- a/include/couch_eunit.hrl
+++ b/include/couch_eunit.hrl
@@ -58,6 +58,23 @@
lists:flatten(io_lib:format("~p~p~p", [A, B, C]))
end).
+%% Like assertEqual, but using == instead of =:=
+-ifndef(assertEquiv).
+-define(assertEquiv(Expect, Expr),
+ ((fun (__X) ->
+ case (Expr) of
+ __V when __V == __X -> ok;
+ __Y -> erlang:error({assertEquiv_failed,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {expected, __X},
+ {value, __Y}]})
+ end
+ end)(Expect))).
+-endif.
+-define(_assertEquiv(Expect, Expr), ?_test(?assertEquiv(Expect, Expr))).
+
%% 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).