diff --git a/spec/inspect_spec.lua b/spec/inspect_spec.lua index ac7f186..d9e35b1 100644 --- a/spec/inspect_spec.lua +++ b/spec/inspect_spec.lua @@ -58,6 +58,23 @@ context( 'inspect', function() assert_equal(inspect({a = 1, b = 2}), "{\n a = 1,\n b = 2\n}") 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, + [] = 1 +}]]) + end) + test('Should work with nested dictionary tables', function() assert_equal(inspect( {d=3, b={c=2}, a=1} ), [[{ a = 1,