[erlang-questions] EUnit

Hasan Veldstra hasan.veldstra@REDACTED
Tue Mar 11 08:00:12 CET 2008


Andrew Stone wrote:
> Thanks Richard. But I'm still having a little trouble. What I meant was how do I create a fixture etc...?

Here's an example of a simple fixture:

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 agree, the docs are a bit cryptic and it took me a wee while to figure it out.

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



More information about the erlang-questions mailing list