diff options
author | Fredrik Gustafsson <fredrik@erlang.org> | 2013-02-28 09:39:42 +0100 |
---|---|---|
committer | Fredrik Gustafsson <fredrik@erlang.org> | 2013-02-28 09:39:42 +0100 |
commit | 9127bc5a597e2f364254bb5c57b3ffd9713e3957 (patch) | |
tree | c3ed35a9d3c207ed267e674c261c5ad5e44d34c9 /lib/stdlib/test/stdlib_SUITE.erl | |
parent | 348871bbd738de5079502a240fb105aec5f36d5c (diff) | |
parent | c15ad44f7664e204eaae9167ca56676af27c2d8b (diff) | |
download | erlang-9127bc5a597e2f364254bb5c57b3ffd9713e3957.tar.gz |
Merge branch 'rc/break-out-asserts' into master-pu
Diffstat (limited to 'lib/stdlib/test/stdlib_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/stdlib_SUITE.erl | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/stdlib/test/stdlib_SUITE.erl b/lib/stdlib/test/stdlib_SUITE.erl index 8a2cb5ea6b..eb71463deb 100644 --- a/lib/stdlib/test/stdlib_SUITE.erl +++ b/lib/stdlib/test/stdlib_SUITE.erl @@ -33,7 +33,7 @@ -export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. --export([app_test/1, appup_test/1]). +-export([app_test/1, appup_test/1, assert_test/1]). %% %% all/1 @@ -41,7 +41,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test, appup_test]. + [app_test, appup_test, assert_test]. groups() -> []. @@ -136,3 +136,28 @@ check_appup([Vsn|Vsns],Instrs,Expected) -> end; check_appup([],_,_) -> ok. + +-include_lib("stdlib/include/assert.hrl"). +-include_lib("stdlib/include/assert.hrl"). % test repeated inclusion +assert_test(suite) -> + []; +assert_test(doc) -> + ["Assert macros test."]; +assert_test(_Config) -> + ?assert(1 =:= 1), + ?assertNot(1 =:= 1.0), + ?assertMatch({foo,_}, {foo,bar}), + ?assertNotMatch({foo,_}, {foo,bar,baz}), + ?assertMatch({foo,N} when N > 0, {foo,1}), + ?assertNotMatch({foo,N} when N > 0, {foo,0}), + ?assertEqual(1.0, 1.0), + ?assertNotEqual(1, 1.0), + ?assertException(error, badarith, 1/0), + ?assertException(exit, foo, exit(foo)), + ?assertException(throw, foo, throw(foo)), + ?assertException(throw, {foo,_}, throw({foo,bar})), + ?assertNotException(throw, {foo,baz}, throw({foo,bar})), + ?assertError(badarith, 1/0), + ?assertExit(foo, exit(foo)), + ?assertThrow(foo, throw(foo)), + ok. |