1. Serge Zaitsev
  2. jsmn
  3. Issues
Issue #17 duplicate

create new Testcases to improve code coverage

Anonymous created an issue

Are the last two errors?

js = "{\"a\": \003 0}"; jsmn_init(&p); r = jsmn_parse(&p, js, tokens, 10); check(r == JSMN_ERROR_INVAL);

js = "{\"a\": \"hallo \\u1234\"}";
jsmn_init(&p);
r = jsmn_parse(&p, js, tokens, 10);
check(r == JSMN_SUCCESS);

js = "{\"a\": \"hallo \\i}";
jsmn_init(&p);
r = jsmn_parse(&p, js, tokens, 10);
check(r == JSMN_ERROR_INVAL);

js = "{\"a\": }";
jsmn_init(&p);
r = jsmn_parse(&p, js, tokens, 10);
check(r == JSMN_SUCCESS); // todo is this really correct ????

js = "{\"a\" }";
jsmn_init(&p);
r = jsmn_parse(&p, js, tokens, 10);
check(r == JSMN_SUCCESS); // todo is this really correct ????

Comments (2)

  1. Serge Zaitsev repo owner

    Abslutely right, those are invalid JSONs, so successful parsing is an error. I never intended jsmn to be a proper strict parser, but if I find a simple solution to add this validation check - I'll fix it.

    However, this issue is a duplicate of Issue #15, so closing. Thanks for reporting!

  2. Log in to comment