From f02fcc96a21851904009cce3594b9ed7fba0be85 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 25 Nov 2024 11:28:14 +0100 Subject: [PATCH] JsonArray: remove redundant tests --- extras/tests/JsonArray/CMakeLists.txt | 1 - extras/tests/JsonArray/std_string.cpp | 34 --------------------------- 2 files changed, 35 deletions(-) delete mode 100644 extras/tests/JsonArray/std_string.cpp diff --git a/extras/tests/JsonArray/CMakeLists.txt b/extras/tests/JsonArray/CMakeLists.txt index bb9719a3..2ee1a34d 100644 --- a/extras/tests/JsonArray/CMakeLists.txt +++ b/extras/tests/JsonArray/CMakeLists.txt @@ -13,7 +13,6 @@ add_executable(JsonArrayTests nesting.cpp remove.cpp size.cpp - std_string.cpp subscript.cpp unbound.cpp ) diff --git a/extras/tests/JsonArray/std_string.cpp b/extras/tests/JsonArray/std_string.cpp deleted file mode 100644 index d6cae2e6..00000000 --- a/extras/tests/JsonArray/std_string.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// ArduinoJson - https://arduinojson.org -// Copyright © 2014-2024, Benoit BLANCHON -// MIT License - -#include -#include - -#include "Literals.hpp" - -static void eraseString(std::string& str) { - char* p = const_cast(str.c_str()); - while (*p) - *p++ = '*'; -} - -TEST_CASE("std::string") { - JsonDocument doc; - JsonArray array = doc.to(); - - SECTION("add()") { - std::string value("hello"); - array.add(value); - eraseString(value); - REQUIRE("hello"_s == array[0]); - } - - SECTION("operator[]") { - std::string value("world"); - array.add("hello"); - array[0] = value; - eraseString(value); - REQUIRE("world"_s == array[0]); - } -}