int rc;
size_t len = strlen(jsonstring);
# ifndef WITH_YAJL2
- yajl_parser_config cfg = { 0, 1 };
+ yajl_parser_config cfg = { 0, 1 }; /* Match yajl 2 default behavior */
virJSONValuePtr tmp;
# endif
# ifdef WITH_YAJL2
hand = yajl_alloc(&parserCallbacks, NULL, &parser);
- if (hand) {
- yajl_config(hand, yajl_allow_comments, 0);
- yajl_config(hand, yajl_dont_validate_strings, 0);
- }
# else
hand = yajl_alloc(&parserCallbacks, &cfg, NULL, &parser);
# endif
DO_TEST_PARSE_FAIL("trailing garbage", "[] []");
DO_TEST_PARSE_FAIL("list without array", "1, 1");
DO_TEST_PARSE_FAIL("parser abuse", "1] [2");
+ DO_TEST_PARSE_FAIL("invalid UTF-8", "\"\x80\"");
DO_TEST_PARSE_FAIL("object with numeric keys", "{ 1:1, 2:1, 3:2 }");
DO_TEST_PARSE_FAIL("unterminated object", "{ \"1\":1, \"2\":1, \"3\":2");
DO_TEST_PARSE_FAIL("array of an object with an array as a key",
"[ {[\"key1\", \"key2\"]: \"value\"} ]");
DO_TEST_PARSE_FAIL("object with unterminated key", "{ \"key:7 }");
+ DO_TEST_PARSE_FAIL("duplicate key", "{ \"a\": 1, \"a\": 1 }");
DO_TEST_FULL("lookup on array", Lookup,
"[ 1 ]", NULL, false);