lua-TestMore
an Unit Testing Framework

References

plan( arg )

skip_all( reason )

BAIL_OUT( reason )

ok( test [, name] )

nok( test [, name] )

is( got, expected [, name] )

isnt( got, expected [, name] )

like( got, pattern [, name] )

unlike( got, pattern [, name] )

cmp_ok( this, op, that [, name] )

type_ok( val, t [, name] )

pass( name )

fail( name )

require_ok( mod )

eq_array( got, expected [, name] )

is_deeply( got, expected [, name] )

error_is( code [, params_array], expected [, name] )

error_like( code [, params_array], pattern [, name] )

lives_ok( code [, params_array] [, name] )

diag( msg )

note( msg )

skip( reason [, count] )

todo_skip( reason )

skip_rest( reason )

todo( reason [, count] )

Examples

require 'Test.More'

plan(9)

ok(true, "true")
ok(1, "1 is true")
nok(false, "false")
nok(nil, "nil is false")

is(1 + 1, 2, "addition")

like("with aaa", 'a', "pattern matches")
unlike("with aaa", 'b', "pattern doesn't match")

error_like([[error 'MSG']], '^[^:]+:%d+: MSG', "loadstring error")
error_is(error, { 'MSG' }, 'MSG', "function error with param")