From 83a501ea0e93f09425c04af8c76d1ebba842fdca Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 May 2021 19:13:38 +0100 Subject: Test case for named type not existing --- test/fixtures/json/bad_type.json | 3 +++ test/test-persistence.cpp | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 test/fixtures/json/bad_type.json diff --git a/test/fixtures/json/bad_type.json b/test/fixtures/json/bad_type.json new file mode 100644 index 0000000..f316bd1 --- /dev/null +++ b/test/fixtures/json/bad_type.json @@ -0,0 +1,3 @@ +{ + "@typeid": "no such type" +} diff --git a/test/test-persistence.cpp b/test/test-persistence.cpp index a7b328d..f94ca81 100644 --- a/test/test-persistence.cpp +++ b/test/test-persistence.cpp @@ -159,6 +159,11 @@ BOOST_DATA_TEST_CASE_F(JPP, various_parse_failures, fixtures_in(FIXTURESDIR "jso BOOST_CHECK_THROW(load_json>(path), std::runtime_error); } +BOOST_FIXTURE_TEST_CASE(load_obj_no_such_type, JPP) +{ + BOOST_CHECK_THROW(load_json>(FIXTURESDIR "json/bad_type.json"), std::out_of_range); +} + BOOST_FIXTURE_TEST_CASE(load_abs_object, JPP) { auto to = load_json>(FIXTURESDIR "json/abs.json"); -- cgit v1.2.3