From 106705ed739b23036bbed87ac17c140c352d115f Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 3 May 2015 20:42:24 +0200 Subject: [PATCH] more tests --- test/unit.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/unit.cpp b/test/unit.cpp index 3f337c65..3a9c37fe 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -7761,6 +7761,39 @@ TEST_CASE("parser class") CHECK (j_array == json({1, 3, 4, 5})); } + + SECTION("filter specific events") + { + json j_object = json::parse(s_object, [](int, json::parse_event_t e, const json &) + { + // filter all number(2) elements + if (e == json::parse_event_t::object_end) + { + return false; + } + else + { + return true; + } + }); + + CHECK (j_object.is_discarded()); + + json j_array = json::parse(s_array, [](int, json::parse_event_t e, const json &) + { + // filter all number(2) elements + if (e == json::parse_event_t::array_end) + { + return false; + } + else + { + return true; + } + }); + + CHECK (j_array.is_discarded()); + } } }