From c25b42a6104ef1faef8ca9b283e8c1e57e2afc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Garc=C3=ADa=20Cota?= Date: Sun, 24 Apr 2011 01:11:51 +0200 Subject: [PATCH] keys sorting is now explicitly tested --- spec/inspect_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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,