1 -- Some primitives for tests.
3 -- Success indicators go to the terminal; failures go to the window.
4 -- I don't know what I am doing.
14 function check_nil(x
, msg
)
18 error(msg
..'; should be nil but got "'..x
..'"')
22 function check_eq(x
, expected
, msg
)
23 if eq(x
, expected
) then
26 error(msg
..'; got "'..x
..'"')
31 if type(a
) ~= type(b
) then return false end
32 if type(a
) == 'table' then
33 if #a
~= #b
then return false end
34 for k
, v
in pairs(a
) do
35 if not eq(b
[k
], v
) then
39 for k
, v
in pairs(b
) do
40 if not eq(a
[k
], v
) then