mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
[utils] Adding test_js_to_json_landofoz
This commit is contained in:
parent
321045a3d5
commit
d88d4535be
@ -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"})
|
||||
|
Loading…
x
Reference in New Issue
Block a user