1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-18 11:20:02 +00:00
CC-Tweaked/src/test/resources/data/computercraft/lua/rom/autorun/cctest.lua
Jonathan Coates f96d923b2a
Allow cleaning dyed turtles in a cauldron
Fixes #771. This does not allow clearing pocket computers or disks right
now - neither normally responds very well to water!
2021-05-29 15:18:53 +01:00

26 lines
780 B
Lua

--- Extend the test API with some convenience functions.
--
-- It's much easier to declare these in Lua rather than Java.
function test.assert(ok, ...)
if ok then return ... end
test.fail(... and tostring(...) or "Assertion failed")
end
function test.eq(expected, actual, msg)
if expected == actual then return end
local message = ("Assertion failed:\nExpected %s,\ngot %s"):format(expected, actual)
if msg then message = ("%s - %s"):format(msg, message) end
test.fail(message)
end
function test.neq(expected, actual, msg)
if expected ~= actual then return end
local message = ("Assertion failed:\nExpected something different to %s"):format(expected)
if msg then message = ("%s - %s"):format(msg, message) end
test.fail(message)
end