diff --git a/README.md b/README.md index 22ab137b7..7d4524b08 100644 --- a/README.md +++ b/README.md @@ -379,7 +379,7 @@ $ make $ ./json_unit =============================================================================== -All tests passed (4280 assertions in 16 test cases) +All tests passed (4332 assertions in 18 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 cd79db69c..b0ac7573b 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -2050,6 +2050,11 @@ TEST_CASE("value conversion") //auto m4 = j4.get>(); //CHECK(m4["one"] == "eins"); } + + SECTION("exception in case of a non-object type") + { + CHECK_THROWS_AS((json().get>()), std::logic_error); + } } SECTION("array-like STL containers") @@ -2106,6 +2111,13 @@ TEST_CASE("value conversion") auto m3 = j3.get>(); auto m4 = j4.get>(); } + + SECTION("exception in case of a non-object type") + { + CHECK_THROWS_AS((json().get>()), std::logic_error); + CHECK_THROWS_AS((json().get>()), std::logic_error); + CHECK_THROWS_AS((json().get>()), std::logic_error); + } } } }