i'm going through eunit chapter in learn erlang , 1 thing noticing code samples test functions never declared in -export() clauses.
why eunit able pick these test functions up?
the simplest way use eunit in erlang module add following line @ beginning of module (after
-moduledeclaration, before function definitions):-include_lib("eunit/include/eunit.hrl").this have following effect:
creates exported function
test()(unless testing turned off, , module not contain test() function), can used run unit tests defined in module
causes functions names match
..._test()or..._test_()to automatically exported module (unless testing turned off, oreunit_noautomacro defined)
Comments
Post a Comment