Don't use non existing myerror()
[lunit.git] / example.lua
blob45347d5bc8debbc347d06e51cd135e9d00bf6969
2 require "lunit"
6 module( "simple", package.seeall, lunit.testcase )
8 function test_success()
9 assert_true( true, "This test never fails.")
10 end
12 function test_failure()
13 assert_true( false, "This test always fails!")
14 end
18 module( "enhanced", package.seeall, lunit.testcase )
20 local foobar = nil
22 function setup()
23 foobar = "Hello World"
24 end
26 function teardown()
27 foobar = nil
28 end
30 function test1()
31 assert_equal("Hello World", foobar)
32 foobar = string.sub(foobar, 1, 5)
33 assert_equal("Hello", foobar)
34 end
36 function test2()
37 assert_equal("Hello World", foobar)
38 foobar = string.sub(foobar, -5)
39 assert_equal("World", foobar)
40 end