[erlang-questions] Eunit fixtures - can someone show an example?

Hasan Veldstra hasan.veldstra@REDACTED
Fri Mar 27 20:50:30 CET 2009


Here's a basic example:

simple_test_() ->
     {setup, local,
      fun setup/0,   %% This is called before the tests are run (to  
set up things).
      fun cleanup/1, %% This is called after the tests have been run  
(to clean up).
      fun(List) ->   %% The argument to this is the return value of  
setup().
              [
               ?_assert(2*2 == 4),
               ?_assert(not(true) == false)
              ]
      end}.

I haven't tried to run it but it should work.


--
http://12monkeys.co.uk


On 27 Mar 2009, at 19:23PM, ryeguy wrote:

> Can someone show me an example of a test fixture with a setup and
> teardown function? The docs are sparse in this area, and don't have
> any examples of it. I can't figure it out.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list