From 16bb20a09f2760acf170763a82e3f8200d29cf60 Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sun, 5 Apr 2020 10:50:00 -0700 Subject: [PATCH] Add test cases for empty string values --- tests/parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/parse.c b/tests/parse.c index ec3857f..3575170 100644 --- a/tests/parse.c +++ b/tests/parse.c @@ -63,6 +63,7 @@ struct parse_pair should_pass_strings[] = { {"{}", RJP_PARSE_NONE}, {"[]", RJP_PARSE_NONE}, {"\"s\"", RJP_PARSE_NONE}, + {"\"\"", RJP_PARSE_NONE}, {"\"\\n\"", RJP_PARSE_NONE}, {"\"\\\"\"", RJP_PARSE_NONE}, {"\"str\\nstr\"", RJP_PARSE_NONE}, @@ -91,6 +92,7 @@ struct parse_pair should_pass_strings[] = { {" {\t }\n", RJP_PARSE_NONE}, {"5.5 ", RJP_PARSE_NONE}, {"{\"key\":5}", RJP_PARSE_NONE}, + {"{\"key\":\"\"}", RJP_PARSE_NONE}, {"{\"key\":{}}", RJP_PARSE_NONE}, {"{\"\\uD83D\\uDE10\":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}, {"[5,6,6,6,6.6]", RJP_PARSE_NONE}, {"[6,7,]", RJP_PARSE_ALLOW_TRAILING_COMMA}, + {"[\"value\",\"\"]", RJP_PARSE_NONE}, {"{\"1\":1,\"2\":2,}", RJP_PARSE_ALLOW_TRAILING_COMMA}, {"[6,]", 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}, {"5e", RJP_PARSE_NONE}, {"{6}", RJP_PARSE_NONE}, + {"{\"\":5}", RJP_PARSE_NONE}, {"[\"key\":5]", RJP_PARSE_NONE}, {"\"string\n\"", RJP_PARSE_NONE}, {"[3 4]", RJP_PARSE_NONE},