mirror of
https://github.com/kikito/inspect.lua.git
synced 2024-12-15 14:34:21 +00:00
keys sorting is now explicitly tested
This commit is contained in:
parent
80feaaf4d0
commit
c25b42a610
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user