The documentation says:
A simple test object is one of the following:
A nullary functional value (i.e., a fun that takes zero arguments). Examples:
fun () -> ... end fun some_function/0 fun some_module:some_function/0 A tuple {test, ModuleName, FunctionName}, where ModuleName and FunctionName are atoms, referring to the function
ModuleName:FunctionName/0
A pair {LineNumber, SimpleTest}, where LineNumber is a nonnegative integer and SimpleTest is another simple test object. LineNumber
should indicate the source line of the test. Pairs like this are usually only created via ?_test(...) macros; see Basic macros.
So you could specify your test as for example:
generator_test_() ->
{setup, fun setup/0, fun cleanup/1,
{inorder,
[
fun() -> some_test1() end
%% OR
fun some_test1/0
]
}
}.
Besides:
(Note that these macros also have corresponding forms which start with an "_" (underscore) character, as in ?_assert(BoolExpr), that create a "test object" instead of performing the test immediately. This is equivalent to writing ?_test(assert(BoolExpr)), etc.)
And this is why your ?_* test generators work.
EDIT
Examples 2 and 3 are good ways of doing things. Example 2 puts a simple test fun into tests list. Example 3 generates list of 2 tests because
[?_assertEqual(a, b), ?_assertEqual(a == a)]
is actually expanded to
[fun() -> ?assertEqual(a, b) end, fun() -> ?assertEqual(a, a) end]
Use example 2 if you want variables, and example 3 otherwise. Example 1 doesn't give expected results, because "fun() -> some_test1() end" IS a test itself, and it should perform real assertions (?assert*) instead of producing another tests (?_assert*). I hope it's clear now.