1
0
forked from aniani/vim

patch 8.0.0171: JS style JSON does not support single quotes

Problem:    JS style JSON does not support single quotes.
Solution:   Allow for single quotes. (Yasuhiro Matsumoto, closes #1371)
This commit is contained in:
Bram Moolenaar
2017-01-11 21:50:08 +01:00
parent e32abbe42c
commit ee142add22
5 changed files with 26 additions and 7 deletions

View File

@@ -145,6 +145,8 @@ func Test_json_decode()
call assert_equal("", json_decode('""'))
call assert_equal({'n': 1}, json_decode('{"n":1,}'))
call assert_fails("call json_decode(\"{'n':'1',}\")", 'E474:')
call assert_fails("call json_decode(\"'n'\")", 'E474:')
call assert_fails('call json_decode("\"")', "E474:")
call assert_fails('call json_decode("blah")', "E474:")
@@ -255,8 +257,11 @@ func Test_js_decode()
call assert_equal(v:none, js_decode(''))
call assert_equal(type(v:none), type(js_decode('')))
call assert_equal("", js_decode('""'))
call assert_equal("", js_decode("''"))
call assert_equal('n', js_decode("'n'"))
call assert_equal({'n': 1}, js_decode('{"n":1,}'))
call assert_equal({'n': '1'}, js_decode("{'n':'1',}"))
call assert_fails('call js_decode("\"")', "E474:")
call assert_fails('call js_decode("blah")', "E474:")