Today I stumbled upon this article about JSON:
http://seriot.ch/parsing_json.php
The article links to a set of tests:
https://github.com/nst/JSONTestSuite
A quick run of the "y" and "n" tests against Vim's json_decode()
finds a few problems. Not particularly ground-breaking, but perhaps
worth fixing:
* These should be accepted, but aren't:
json_decode('{"a":"b","a":"c"}') " E685
json_decode('{"a":"b","a":"b"}') " E685
json_decode('{"":0}') " E474
* These should be rejected, but aren't:
json_decode('["",]') " ['']
json_decode('[1,]') " [1]
json_decode('{1:1}') " {'1': 1}
json_decode('{"id":0,}') " {'id': 0}
json_decode('["\uD800\u"]') " ['<d800>']
json_decode('["\uD800\u1"]') " ['<d800><01>']
json_decode('["\uD800\u1x"]') " ['<d800><01>x']
json_decode('["\x00"]') " ['x00']
json_decode('["\a"]') " ['a']
json_decode('[True]') " [v:true]
* There is even a segfault:
json_decode(repeat('[', 100000)) " segfault
There are others, the above are just the main ones. Also, for the
"n" tests I was just checking that json_decode() rises an exception, not
that the exception rised actually makes sense.
/lcd
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.