summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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");