diff options
Diffstat (limited to 'test.lua')
-rw-r--r-- | test.lua | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/test.lua b/test.lua index ab890b8..cc94d94 100644 --- a/test.lua +++ b/test.lua @@ -1,29 +1,20 @@ -- Some primitives for tests. --- --- Success indicators go to the terminal; failures go to the window. --- I don't know what I am doing. function check(x, msg) - if x then - io.write('.') - else + if not x then error(msg) end end function check_nil(x, msg) - if x == nil then - io.write('.') - else + if x ~= nil then error(msg..'; should be nil but got "'..x..'"') end end function check_eq(x, expected, msg) - if eq(x, expected) then - io.write('.') - else - error(msg..'; got "'..x..'"') + if not eq(x, expected) then + error(msg..'; should be "'..expected..'" but got "'..x..'"') end end |