mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-14 11:06:35 +02:00
Tests: add user-defined literal ""_s
for std::string
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Literals.hpp"
|
||||
|
||||
static void eraseString(std::string& str) {
|
||||
char* p = const_cast<char*>(str.c_str());
|
||||
while (*p)
|
||||
@ -19,7 +21,7 @@ TEST_CASE("std::string") {
|
||||
std::string value("hello");
|
||||
array.add(value);
|
||||
eraseString(value);
|
||||
REQUIRE(std::string("hello") == array[0]);
|
||||
REQUIRE("hello"_s == array[0]);
|
||||
}
|
||||
|
||||
SECTION("operator[]") {
|
||||
@ -27,6 +29,6 @@ TEST_CASE("std::string") {
|
||||
array.add("hello");
|
||||
array[0] = value;
|
||||
eraseString(value);
|
||||
REQUIRE(std::string("world") == array[0]);
|
||||
REQUIRE("world"_s == array[0]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user