From ed31ebcb48194ee2e57bb04f6512f714e0f3d271 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Fri, 1 Aug 2008 00:08:33 -0400 Subject: [PATCH] test: Updated regression tests for roundtripping to have a better output format and handle outer whitespace and moved tests --- tests/regressionTest.lua | 7 +++++-- ...{pass_simple02.json => stringWithEscapedAndUnescapedSlash.json} | 0 tests/test/{pass/pass2.json => roundtrip/deepArray.json} | 0 tests/test/{pass/pass4.json => roundtrip/emptyArray.json} | 0 tests/test/{pass/pass5.json => roundtrip/emptyObject.json} | 0 .../pass_simple01.json => roundtrip/simpleArrayInObject.json} | 0 6 files changed, 5 insertions(+), 2 deletions(-) rename tests/test/pass/{pass_simple02.json => stringWithEscapedAndUnescapedSlash.json} (100%) rename tests/test/{pass/pass2.json => roundtrip/deepArray.json} (100%) rename tests/test/{pass/pass4.json => roundtrip/emptyArray.json} (100%) rename tests/test/{pass/pass5.json => roundtrip/emptyObject.json} (100%) rename tests/test/{pass/pass_simple01.json => roundtrip/simpleArrayInObject.json} (100%) diff --git a/tests/regressionTest.lua b/tests/regressionTest.lua index 84fea76..c2967e5 100644 --- a/tests/regressionTest.lua +++ b/tests/regressionTest.lua @@ -34,10 +34,13 @@ local function RoundTripTest(parseFunc, jsonData, luaData, fullRoundTrip) return end if fullRoundTrip then + -- Ensure that whitespace is trimmed off ends + dataString = dataString:match("^[%s]*(.-)[%s]*$") + jsonData = jsonData:match("^[%s]*(.-)[%s]*$") if dataString ~= jsonData then print("Encoded values do not match") - print("ORIGINAL: [[" .. jsonData .. "]]") - print("RE-ENCOD: [[" .. dataString .. "]])") + print("ORIGINAL: << " .. jsonData .. " >>") + print("RE-ENCOD: << " .. dataString .. " >>") return end end diff --git a/tests/test/pass/pass_simple02.json b/tests/test/pass/stringWithEscapedAndUnescapedSlash.json similarity index 100% rename from tests/test/pass/pass_simple02.json rename to tests/test/pass/stringWithEscapedAndUnescapedSlash.json diff --git a/tests/test/pass/pass2.json b/tests/test/roundtrip/deepArray.json similarity index 100% rename from tests/test/pass/pass2.json rename to tests/test/roundtrip/deepArray.json diff --git a/tests/test/pass/pass4.json b/tests/test/roundtrip/emptyArray.json similarity index 100% rename from tests/test/pass/pass4.json rename to tests/test/roundtrip/emptyArray.json diff --git a/tests/test/pass/pass5.json b/tests/test/roundtrip/emptyObject.json similarity index 100% rename from tests/test/pass/pass5.json rename to tests/test/roundtrip/emptyObject.json diff --git a/tests/test/pass/pass_simple01.json b/tests/test/roundtrip/simpleArrayInObject.json similarity index 100% rename from tests/test/pass/pass_simple01.json rename to tests/test/roundtrip/simpleArrayInObject.json -- 2.11.4.GIT