Skip to content

Commit

Permalink
strict checking fails a test, add {}s to fix it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Paul Rubel committed Dec 13, 2016
1 parent 1682c32 commit 6572217
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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}";
Expand Down

0 comments on commit 6572217

Please sign in to comment.