From d88d4535be1d7975346b54f4fffa138a51a98d5f Mon Sep 17 00:00:00 2001 From: sulyi Date: Mon, 21 Nov 2016 11:44:55 +0100 Subject: [PATCH] [utils] Adding test_js_to_json_landofoz --- test/test_utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test_utils.py b/test/test_utils.py index 2e3cd0179..c9a3a851d 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -743,6 +743,26 @@ class TestUtil(unittest.TestCase): inp = '''{"duration": "00:01:07"}''' self.assertEqual(js_to_json(inp), '''{"duration": "00:01:07"}''') + def test_js_to_json_landofoz(self): + inp = '''{ + character: { + name: "Dorothy", + pet: "Toto", + /* source: "Kansas", + destination: "Emerald City", + roll: "heroine" */ + }, + comment: /* over the rainbow */ "/*", + no_comment: "*/" + }''' + self.assertEqual(js_to_json(inp), '''{ + "character": { + "name": "Dorothy", + "pet": "Toto"\n \n }, + "comment": "/*", + "no_comment": "*/" + }''') + def test_js_to_json_edgecases(self): on = js_to_json("{abc_def:'1\\'\\\\2\\\\\\'3\"4'}") self.assertEqual(json.loads(on), {"abc_def": "1'\\2\\'3\"4"})