1 -- Some primitives for tests.
9 function check_nil(x
, msg
)
11 error(msg
..'; should be nil but got "'..x
..'"')
15 function check_eq(x
, expected
, msg
)
16 if not eq(x
, expected
) then
17 error(msg
..'; should be "'..expected
..'" but got "'..x
..'"')
22 if type(a
) ~= type(b
) then return false end
23 if type(a
) == 'table' then
24 if #a
~= #b
then return false end
25 for k
, v
in pairs(a
) do
26 if not eq(b
[k
], v
) then
30 for k
, v
in pairs(b
) do
31 if not eq(a
[k
], v
) then