diff options
author | Paul Rubel <prubel@akamai.com> | 2016-12-13 15:23:23 -0500 |
---|---|---|
committer | Paul Rubel <prubel@akamai.com> | 2016-12-13 15:23:23 -0500 |
commit | 6572217a0e71fdc13c9ea5571203187f383665e0 (patch) | |
tree | a30df017cc2c6e39333fe265532705d7f28a3508 /test | |
parent | 1682c32e9ae5990ddd0f0e907270a0f6dde5cbe9 (diff) |
strict checking fails a test, add {}s to fix it
The current test looks for success, but since there are
no surrounding {}s the test fails. Add them in and add
a test like the one that we replace but only in the
non-strict code path.
Diffstat (limited to 'test')
-rw-r--r-- | test/tests.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/tests.c b/test/tests.c index d5f0c5300..31761cd33 100644 --- a/test/tests.c +++ b/test/tests.c @@ -353,6 +353,14 @@ int test_nonstrict(void) { JSMN_PRIMITIVE, "Sep", JSMN_PRIMITIVE, "Year", JSMN_PRIMITIVE, "12")); + + //nested {s don't cause a parse error. + js = "\"key {1\": 1234"; + check(parse(js, 2, 2, + JSMN_STRING, "key {1", 1, + JSMN_PRIMITIVE, "1234")); + + #endif return 0; } @@ -367,8 +375,9 @@ int test_unmatched_brackets(void) { check(parse(js, JSMN_ERROR_INVAL, 3)); js = "\"key 1\"}: 1234"; check(parse(js, JSMN_ERROR_INVAL, 3)); - js = "\"key {1\": 1234"; - check(parse(js, 2, 2, + js = "{\"key {1\": 1234}"; + check(parse(js, 3, 3, + JSMN_OBJECT, 0, 16, 1, JSMN_STRING, "key {1", 1, JSMN_PRIMITIVE, "1234")); js = "{{\"key 1\": 1234}"; |