added test cases
This commit is contained in:
parent
869035a6c9
commit
bb142d6cae
2 changed files with 12 additions and 1 deletions
|
@ -396,7 +396,7 @@ $ make
|
||||||
$ ./json_unit
|
$ ./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).
|
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
||||||
|
|
|
@ -7377,6 +7377,15 @@ TEST_CASE("parser class")
|
||||||
// empty string
|
// empty string
|
||||||
CHECK(json::parser("\"\"").parse() == json(json::value_t::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")
|
SECTION("escaped")
|
||||||
{
|
{
|
||||||
// quotation mark "\""
|
// quotation mark "\""
|
||||||
|
@ -8524,11 +8533,13 @@ TEST_CASE("regression tests")
|
||||||
SECTION("NAN value")
|
SECTION("NAN value")
|
||||||
{
|
{
|
||||||
CHECK(json(NAN) == json());
|
CHECK(json(NAN) == json());
|
||||||
|
CHECK(json(json::number_float_t(NAN)) == json());
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("infinity")
|
SECTION("infinity")
|
||||||
{
|
{
|
||||||
CHECK(json(INFINITY) == json());
|
CHECK(json(INFINITY) == json());
|
||||||
|
CHECK(json(json::number_float_t(INFINITY)) == json());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue