Add test cases for empty string values

This commit is contained in:
rexy712 2020-04-05 10:50:00 -07:00
parent e708952c05
commit 16bb20a09f

View File

@ -63,6 +63,7 @@ struct parse_pair should_pass_strings[] = {
{"{}", RJP_PARSE_NONE}, {"{}", RJP_PARSE_NONE},
{"[]", RJP_PARSE_NONE}, {"[]", RJP_PARSE_NONE},
{"\"s\"", RJP_PARSE_NONE}, {"\"s\"", RJP_PARSE_NONE},
{"\"\"", RJP_PARSE_NONE},
{"\"\\n\"", RJP_PARSE_NONE}, {"\"\\n\"", RJP_PARSE_NONE},
{"\"\\\"\"", RJP_PARSE_NONE}, {"\"\\\"\"", RJP_PARSE_NONE},
{"\"str\\nstr\"", RJP_PARSE_NONE}, {"\"str\\nstr\"", RJP_PARSE_NONE},
@ -91,6 +92,7 @@ struct parse_pair should_pass_strings[] = {
{" {\t }\n", RJP_PARSE_NONE}, {" {\t }\n", RJP_PARSE_NONE},
{"5.5 ", RJP_PARSE_NONE}, {"5.5 ", RJP_PARSE_NONE},
{"{\"key\":5}", RJP_PARSE_NONE}, {"{\"key\":5}", RJP_PARSE_NONE},
{"{\"key\":\"\"}", RJP_PARSE_NONE},
{"{\"key\":{}}", RJP_PARSE_NONE}, {"{\"key\":{}}", RJP_PARSE_NONE},
{"{\"\\uD83D\\uDE10\":5}", RJP_PARSE_NONE}, {"{\"\\uD83D\\uDE10\":5}", RJP_PARSE_NONE},
{"{\"😐\":5}", RJP_PARSE_NONE}, {"{\"😐\":5}", RJP_PARSE_NONE},
@ -104,6 +106,7 @@ struct parse_pair should_pass_strings[] = {
{"[{\"arr\":[5,6,6]}, 6]", RJP_PARSE_NONE}, {"[{\"arr\":[5,6,6]}, 6]", RJP_PARSE_NONE},
{"[5,6,6,6,6.6]", RJP_PARSE_NONE}, {"[5,6,6,6,6.6]", RJP_PARSE_NONE},
{"[6,7,]", RJP_PARSE_ALLOW_TRAILING_COMMA}, {"[6,7,]", RJP_PARSE_ALLOW_TRAILING_COMMA},
{"[\"value\",\"\"]", RJP_PARSE_NONE},
{"{\"1\":1,\"2\":2,}", RJP_PARSE_ALLOW_TRAILING_COMMA}, {"{\"1\":1,\"2\":2,}", RJP_PARSE_ALLOW_TRAILING_COMMA},
{"[6,]", RJP_PARSE_ALLOW_TRAILING_COMMA}, {"[6,]", RJP_PARSE_ALLOW_TRAILING_COMMA},
{"{\"1\":1,}", RJP_PARSE_ALLOW_TRAILING_COMMA}, {"{\"1\":1,}", RJP_PARSE_ALLOW_TRAILING_COMMA},
@ -128,6 +131,7 @@ struct parse_pair should_fail_strings[] = {
{"6.6e+", RJP_PARSE_NONE}, {"6.6e+", RJP_PARSE_NONE},
{"5e", RJP_PARSE_NONE}, {"5e", RJP_PARSE_NONE},
{"{6}", RJP_PARSE_NONE}, {"{6}", RJP_PARSE_NONE},
{"{\"\":5}", RJP_PARSE_NONE},
{"[\"key\":5]", RJP_PARSE_NONE}, {"[\"key\":5]", RJP_PARSE_NONE},
{"\"string\n\"", RJP_PARSE_NONE}, {"\"string\n\"", RJP_PARSE_NONE},
{"[3 4]", RJP_PARSE_NONE}, {"[3 4]", RJP_PARSE_NONE},