From 0164b10e102f2f8694d380554389a4a4a917f781 Mon Sep 17 00:00:00 2001
From: Niels Lohmann <niels.lohmann@gmail.com>
Date: Sun, 29 Jan 2017 17:18:56 +0100
Subject: [PATCH] :white_check_mark: added missing tests found by mutate++

---
 test/src/unit-class_parser.cpp | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp
index 3dfad5bd..59ea3cef 100644
--- a/test/src/unit-class_parser.cpp
+++ b/test/src/unit-class_parser.cpp
@@ -596,6 +596,32 @@ TEST_CASE("parser class")
                           "missing or wrong low surrogate");
     }
 
+    SECTION("tests found by mutate++")
+    {
+        // test case to make sure no comma preceeds the first key
+        CHECK_THROWS_AS(json::parser("{,\"key\": false}").parse(), std::invalid_argument);
+        // test case to make sure an object is properly closed
+        CHECK_THROWS_AS(json::parser("[{\"key\": false true]").parse(), std::invalid_argument);
+
+        // test case to make sure the callback is properly evaluated after reading a key
+        {
+            json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
+            {
+                if (event == json::parse_event_t::key)
+                {
+                    return false;
+                }
+                else
+                {
+                    return true;
+                }
+            };
+
+            json x = json::parse("{\"key\": false}", cb);
+            CHECK(x == json::object());
+        }
+    }
+
     SECTION("callback function")
     {
         auto s_object = R"(