Permalink
Browse files

update tests

  • Loading branch information...
1 parent 261f516 commit 486206aabb44d71d2917f96374b0a40f7ce75c5c @hyperthunk committed Jan 5, 2011
Showing with 99 additions and 6 deletions.
  1. +17 −0 TODO.md
  2. +4 −4 ebin/hamcrest.app
  3. BIN epm
  4. +2 −2 priv/build/templates/hamcrest.hrl.src
  5. +33 −0 src/hamcrest_term.erl
  6. +3 −0 test/hamcrest_SUITE.erl
  7. +40 −0 test/hamcrest_term_SUITE.erl
View
@@ -0,0 +1,17 @@
+todo list
+=========
+
+- improve error reporting
+ - change semantics of 'matchspec'.desc field
+ - return a description of the matcher *only*
+ - modify assert_that to handle construction of failure messages (?)
+ - support for matchers to return information about match failures
+ - actual input
+ - indirect input/fixture data
+ - explanatory message
+ - defaults for matchers not returning information about match failures
+ - progress reports
+ - *real time* progress logging
+ - support for _stdout_ or _MFA_ (to support _ct:pal/2_ for example)
+ - quiet mode (turn it off!)
+ - provide full _textual_ log post processing (?)
View
@@ -1,8 +1,8 @@
{application,
hamcrest,
[{description,"Hamcrest Matcher Library"},
- {vsn, "0.0.1"},
- {modules,[hamcrest,hamcrest_matchers]},
+ {vsn,"0.0.1"},
+ {modules,[hamcrest,hamcrest_matchers,hamcrest_term]},
{registered,[]},
- {applications,[kernel, stdlib]},
- {env,[]}]}.
+ {applications,[kernel,stdlib]},
+ {env,[]}]}.
View
BIN epm
Binary file not shown.
@@ -29,7 +29,7 @@
-include_lib("hamcrest/include/hamcrest_internal.hrl").
-ifdef(EUNIT_HRL).
-%% TODO: ......
+%% TODO: notify hamcrest that we are using eunit!?
-endif.
-ifndef(assertThat).
@@ -61,5 +61,5 @@
end)())).
-endif.
--import(hamcrest, [assert_that/2]).
+-import(hamcrest, [assert_that/2, assert_that/3]).
-import(hamcrest_matchers, [{{ imports }}]).
View
@@ -0,0 +1,33 @@
+%% -----------------------------------------------------------------------------
+%%
+%% Hamcrest Erlang.
+%%
+%% Copyright (c) 2010 Tim Watson (watson.timothy@gmail.com)
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in
+%% all copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+%% -----------------------------------------------------------------------------
+%% @author Tim Watson <watson.timothy@gmail.com>
+%% @copyright 2010 Tim Watson.
+%% @doc Library functions for pretty printing and formatting terms
+%% @reference See <a href="http://code.google.com/p/hamcrest/">Hamcrest</a>
+%% for more information.
+%% -----------------------------------------------------------------------------
+
+-module(hamcrest_term).
+
@@ -1,3 +1,4 @@
+
%% -----------------------------------------------------------------------------
%%
%% Hamcrest Erlang.
@@ -59,6 +60,8 @@ assert_that_returns_true_from_match_success(_) ->
assert_that(X, is(X))),
?EQC(P).
+%% matchers_can_return_matchresults(_) ->
+
failing_assertions_throw_exceptions(_) ->
MF = is(equal_to(2)),
?assertException(error, {assertion_failed, "Expected a value equal to [2], but was [1]"},
@@ -0,0 +1,40 @@
+%% -----------------------------------------------------------------------------
+%%
+%% Hamcrest Erlang.
+%%
+%% Copyright (c) 2010 Tim Watson (watson.timothy@gmail.com)
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in
+%% all copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+%% -----------------------------------------------------------------------------
+%% @author Tim Watson <watson.timothy@gmail.com>
+%% @copyright 2010 Tim Watson.
+%% -----------------------------------------------------------------------------
+
+-module(hamcrest_term_SUITE).
+
+-include_lib("common_test/include/ct.hrl").
+-include_lib("proper/include/proper.hrl").
+-include("../include/test.hrl").
+-include("../include/hamcrest.hrl").
+
+-import(hamcrest_term, [expectation/2]).
+
+-compile(export_all).
+
+all() -> ?CT_REGISTER_TESTS(?MODULE).

0 comments on commit 486206a

Please sign in to comment.