ソースを参照

Tests: remove duplicate test of incomplete input

Benoit Blanchon 2 年 前
コミット
9122d87f12

+ 30 - 9
extras/tests/JsonDeserializer/incomplete_input.cpp

@@ -7,15 +7,36 @@
 #include <catch.hpp>
 
 TEST_CASE("Truncated JSON input") {
-  const char* testCases[] = {"\"hello", "\'hello", "'\\u", "'\\u00", "'\\u000",
-                             // false
-                             "f", "fa", "fal", "fals",
-                             // true
-                             "t", "tr", "tru",
-                             // null
-                             "n", "nu", "nul",
-                             // object
-                             "{", "{a", "{a:", "{a:1", "{a:1,", "{a:1,"};
+  const char* testCases[] = {
+      // strings
+      "\"\\",
+      "\"hello",
+      "\'hello",
+      // unicode
+      "'\\u",
+      "'\\u00",
+      "'\\u000",
+      // false
+      "f",
+      "fa",
+      "fal",
+      "fals",
+      // true
+      "t",
+      "tr",
+      "tru",
+      // null
+      "n",
+      "nu",
+      "nul",
+      // object
+      "{",
+      "{a",
+      "{a:",
+      "{a:1",
+      "{a:1,",
+      "{a:1,",
+  };
   const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);
 
   JsonDocument doc;

+ 0 - 40
extras/tests/JsonDeserializer/misc.cpp

@@ -72,46 +72,6 @@ TEST_CASE("deserializeJson(JsonDocument&)") {
     }
   }
 
-  SECTION("Premature null-terminator") {
-    SECTION("In escape sequence") {
-      DeserializationError err = deserializeJson(doc, "\"\\");
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-
-    SECTION("In double quoted string") {
-      DeserializationError err = deserializeJson(doc, "\"hello");
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-
-    SECTION("In single quoted string") {
-      DeserializationError err = deserializeJson(doc, "'hello");
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-  }
-
-  SECTION("Premature end of input") {
-    SECTION("In escape sequence") {
-      DeserializationError err = deserializeJson(doc, "\"\\n\"", 2);
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-
-    SECTION("In double quoted string") {
-      DeserializationError err = deserializeJson(doc, "\"hello\"", 6);
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-
-    SECTION("In single quoted string") {
-      DeserializationError err = deserializeJson(doc, "'hello'", 6);
-
-      REQUIRE(err == DeserializationError::IncompleteInput);
-    }
-  }
-
   SECTION("Should clear the JsonVariant") {
     deserializeJson(doc, "[1,2,3]");
     deserializeJson(doc, "{}");