summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-05-01 19:13:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-11-07 16:41:37 +0000
commit83a501ea0e93f09425c04af8c76d1ebba842fdca (patch)
tree748dbf44c29cd99b085cb8c327f0d69c5da8da3a
parentStandard wrapper in failure cases (diff)
downloadilt-83a501ea0e93f09425c04af8c76d1ebba842fdca.tar.bz2
ilt-83a501ea0e93f09425c04af8c76d1ebba842fdca.tar.xz
ilt-83a501ea0e93f09425c04af8c76d1ebba842fdca.zip
Test case for named type not existing
-rw-r--r--test/fixtures/json/bad_type.json3
-rw-r--r--test/test-persistence.cpp5
2 files changed, 8 insertions, 0 deletions
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<std::unique_ptr<TestObject>>(path), std::runtime_error);
}
+BOOST_FIXTURE_TEST_CASE(load_obj_no_such_type, JPP)
+{
+ BOOST_CHECK_THROW(load_json<std::unique_ptr<TestObject>>(FIXTURESDIR "json/bad_type.json"), std::out_of_range);
+}
+
BOOST_FIXTURE_TEST_CASE(load_abs_object, JPP)
{
auto to = load_json<std::unique_ptr<TestObject>>(FIXTURESDIR "json/abs.json");