improved test coverage

This commit is contained in:
Niels 2016-05-07 18:33:43 +02:00
parent ea84a85b13
commit c04275966f
4 changed files with 11 additions and 3 deletions

View file

@ -449,7 +449,7 @@ $ make
$ ./json_unit "*" $ ./json_unit "*"
=============================================================================== ===============================================================================
All tests passed (5568699 assertions in 31 test cases) All tests passed (5568703 assertions in 31 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).

View file

@ -9708,7 +9708,8 @@ basic_json_parser_63:
default: default:
{ {
throw std::domain_error("unexpected parent type " + parent.type_name()); // if there exists a parent it cannot be primitive
assert(false); // LCOV_EXCL_LINE
} }
} }
} }

View file

@ -9018,7 +9018,8 @@ class basic_json
default: default:
{ {
throw std::domain_error("unexpected parent type " + parent.type_name()); // if there exists a parent it cannot be primitive
assert(false); // LCOV_EXCL_LINE
} }
} }
} }

View file

@ -12094,6 +12094,12 @@ TEST_CASE("JSON pointers")
CHECK_THROWS_AS(json::json_pointer("/~"), std::domain_error); CHECK_THROWS_AS(json::json_pointer("/~"), std::domain_error);
CHECK_THROWS_WITH(json::json_pointer("/~"), "escape error: '~' must be followed with '0' or '1'"); CHECK_THROWS_WITH(json::json_pointer("/~"), "escape error: '~' must be followed with '0' or '1'");
json::json_pointer p;
CHECK_THROWS_AS(p.top(), std::domain_error);
CHECK_THROWS_WITH(p.top(), "JSON pointer has no parent");
CHECK_THROWS_AS(p.pop_back(), std::domain_error);
CHECK_THROWS_WITH(p.pop_back(), "JSON pointer has no parent");
} }
SECTION("examples from RFC 6901") SECTION("examples from RFC 6901")