[utils] Handle single-line comments in js_to_json

This commit is contained in:
Michal Čihař 2017-01-31 07:54:53 +01:00 committed by Sergey M․
parent a22b2fd19b
commit b3ee552e4b
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 5 additions and 2 deletions

View file

@ -791,6 +791,9 @@ class TestUtil(unittest.TestCase):
on = js_to_json('{ 0: /* " \n */ ",]" , }')
self.assertEqual(json.loads(on), {'0': ',]'})
on = js_to_json('{ 0: // comment\n1 }')
self.assertEqual(json.loads(on), {'0': 1})
on = js_to_json(r'["<p>x<\/p>"]')
self.assertEqual(json.loads(on), ['<p>x</p>'])