diff --git a/README.md b/README.md index 76358c2e..4be9efd9 100644 --- a/README.md +++ b/README.md @@ -396,7 +396,7 @@ $ make $ ./json_unit =============================================================================== -All tests passed (4673 assertions in 19 test cases) +All tests passed (4707 assertions in 20 test cases) ``` For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml). diff --git a/test/unit.cpp b/test/unit.cpp index d8f5d2d2..58ad4d68 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -7377,6 +7377,15 @@ TEST_CASE("parser class") // empty string CHECK(json::parser("\"\"").parse() == json(json::value_t::string)); + SECTION("errors") + { + // error: tab in string + CHECK_THROWS_AS(json::parser("\"\t\"").parse(), std::invalid_argument); + // error: newline in string + CHECK_THROWS_AS(json::parser("\"\n\"").parse(), std::invalid_argument); + CHECK_THROWS_AS(json::parser("\"\r\"").parse(), std::invalid_argument); + } + SECTION("escaped") { // quotation mark "\"" @@ -8524,11 +8533,13 @@ TEST_CASE("regression tests") SECTION("NAN value") { CHECK(json(NAN) == json()); + CHECK(json(json::number_float_t(NAN)) == json()); } SECTION("infinity") { CHECK(json(INFINITY) == json()); + CHECK(json(json::number_float_t(INFINITY)) == json()); } } }