From 647711fad1e2dd08b14f62d6c4c4b3c563ee4863 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 14 Sep 2017 17:31:28 +0200 Subject: [PATCH] :white_check_mark: improved test coverage --- test/src/unit-json_pointer.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp index a9fbc6130..ee55dc58e 100644 --- a/test/src/unit-json_pointer.cpp +++ b/test/src/unit-json_pointer.cpp @@ -430,4 +430,23 @@ TEST_CASE("JSON pointers") CHECK(json::json_pointer(ptr).to_string() == ptr); } } + + SECTION("conversion") + { + SECTION("array") + { + json j; + // all numbers -> array + j["/12"_json_pointer] = 0; + CHECK(j.is_array()); + } + + SECTION("object") + { + json j; + // contains a number, but is not a number -> object + j["/a12"_json_pointer] = 0; + CHECK(j.is_object()); + } + } }