keys sorting is now explicitly tested

This commit is contained in:
Enrique García Cota 2011-04-24 01:11:51 +02:00
parent 80feaaf4d0
commit c25b42a610

View File

@ -58,6 +58,23 @@ context( 'inspect', function()
assert_equal(inspect({a = 1, b = 2}), "{\n a = 1,\n b = 2\n}") assert_equal(inspect({a = 1, b = 2}), "{\n a = 1,\n b = 2\n}")
end) end)
test('Should sort keys in dictionary tables', function()
local t = { 1,2,3,
[print] = 1, ["buy more"] = 1, a = 1,
[14] = 1, [{c=2}] = 1, [true]= 1
}
assert_equal(inspect(t), [[{ 1, 2, 3,
[14] = 1,
[true] = 1,
a = 1,
["buy more"] = 1,
[{
c = 2
}] = 1,
[<function>] = 1
}]])
end)
test('Should work with nested dictionary tables', function() test('Should work with nested dictionary tables', function()
assert_equal(inspect( {d=3, b={c=2}, a=1} ), [[{ assert_equal(inspect( {d=3, b={c=2}, a=1} ), [[{
a = 1, a = 1,