Created
July 21, 2017 21:21
-
-
Save chewbranca/e97917468d32bedd198c1f370be7915e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(etest). | |
-include_lib("eunit/include/eunit.hrl"). | |
foo_test_() -> | |
{ | |
"Foo-est of tests", | |
{ | |
setup, | |
fun() -> ok end, fun(_) -> ok end, | |
{ | |
foreach, | |
fun() -> ok end, fun(_) -> ok end, | |
[ | |
fun test_the_things/1, | |
fun test_all_the_things/1 | |
] | |
} | |
} | |
}. | |
test_the_things(_) -> | |
?_assertEqual(true, false), | |
?_assertEqual(true, true). | |
test_all_the_things(_) -> | |
[ | |
?_assertEqual(true, false), | |
?_assertEqual(true, true) | |
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5> vagrant@vagrant:/tmp$ erlc etest.erl | |
etest.erl:25: Warning: a term is constructed, but never used | |
vagrant@vagrant:/tmp$ erl | |
Erlang/OTP 17 [erts-6.4.1] [source-381fb6c] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] | |
Eshell V6.4.1 (abort with ^G) | |
1> l(etest). | |
{module,etest} | |
2> eunit:test(etest, [verbose]). | |
======================== EUnit ======================== | |
module 'etest' | |
Foo-est of tests | |
etest:26: test_the_things...ok | |
etest:31: test_all_the_things...*failed* | |
in function etest:'-test_all_the_things/1-fun-0-'/1 (etest.erl, line 31) | |
**error:{assertEqual_failed,[{module,etest}, | |
{line,31}, | |
{expression,"false"}, | |
{expected,true}, | |
{value,false}]} | |
etest:32: test_all_the_things...ok | |
[done in 0.010 s] | |
[done in 0.010 s] | |
======================================================= | |
Failed: 1. Skipped: 0. Passed: 2. | |
error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment