Commit f7fc3fd4 authored by Huff, Israel's avatar Huff, Israel

- changed handling of parse errors to use boolean returns instead of using...

- changed handling of parse errors to use boolean returns instead of using is_null() since using the later causes "null" literals to fail
- fixed a few parser bugs found by unit tests
- fixed a bug in unit test code causing false negatives
- now allowing one trailing comma in arrays and objects
parent ff54c93e
Pipeline #96293 failed with stages
in 50 minutes and 59 seconds
This diff is collapsed.
......@@ -253,7 +253,12 @@ bool parse_and_test(const std::string& file)
{
return_success = !success;
}
if (!return_success)
else
{
return_success = success;
}
// only show error if parse failed and it was supposed to succeed
if (!success && !return_success)
{
// dump the json error
std::cout << parser.last_error() << std::endl;
......@@ -271,12 +276,12 @@ TEST(JSONParser, JSONCheckerFailures)
// EXPECT_TRUE(parse_and_test("fail01_EXCLUDE.json"));
EXPECT_TRUE(parse_and_test("fail02.json"));
EXPECT_TRUE(parse_and_test("fail03.json"));
EXPECT_TRUE(parse_and_test("fail04.json"));
EXPECT_FALSE(parse_and_test("fail04.json"));
EXPECT_TRUE(parse_and_test("fail05.json"));
EXPECT_TRUE(parse_and_test("fail06.json"));
EXPECT_TRUE(parse_and_test("fail07.json"));
EXPECT_TRUE(parse_and_test("fail08.json"));
EXPECT_TRUE(parse_and_test("fail09.json"));
EXPECT_FALSE(parse_and_test("fail09.json"));
EXPECT_TRUE(parse_and_test("fail10.json"));
EXPECT_TRUE(parse_and_test("fail11.json"));
EXPECT_TRUE(parse_and_test("fail12.json"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment