From 84673b7de38df50d4cdb32a5e78e3e5857291d58 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 24 Jul 2016 11:08:39 +0200 Subject: [PATCH] added test case from issue #283 --- test/src/unit.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/src/unit.cpp b/test/src/unit.cpp index 92ba97b0..a1589949 100644 --- a/test/src/unit.cpp +++ b/test/src/unit.cpp @@ -14331,6 +14331,19 @@ TEST_CASE("regression tests") // check roundtrip CHECK(doc.patch(json::diff(doc, expected)) == expected); } + + SECTION("issue #283 - value() does not work with _json_pointer types") + { + json j = + { + {"object", {{"key1", 1}, {"key2", 2}}}, + }; + + int at_integer = j.at("/object/key2"_json_pointer); + int val_integer = j.value("/object/key2"_json_pointer, 0); + + CHECK(at_integer == val_integer); + } } // special test case to check if memory is leaked if constructor throws