erlang - Why does Eunit not require test functions to be exported? -


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?

from documentation:

the simplest way use eunit in erlang module add following line @ beginning of module (after -module declaration, 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, or eunit_noauto macro defined)


Comments