mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-11-15 14:59:23 +01:00
Tests: add user-defined literal ""_s for std::string
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <catch.hpp>
|
||||
#include "Allocators.hpp"
|
||||
|
||||
#include "Literals.hpp"
|
||||
|
||||
TEST_CASE("JsonVariant::set(JsonVariant)") {
|
||||
KillswitchAllocator killswitch;
|
||||
SpyingAllocator spyingAllocator(&killswitch);
|
||||
@@ -72,7 +74,7 @@ TEST_CASE("JsonVariant::set(JsonVariant)") {
|
||||
}
|
||||
|
||||
SECTION("stores std::string by copy") {
|
||||
var1.set(std::string("hello!!"));
|
||||
var1.set("hello!!"_s);
|
||||
spyingAllocator.clearLog();
|
||||
|
||||
var2.set(var1);
|
||||
@@ -106,7 +108,7 @@ TEST_CASE("JsonVariant::set(JsonVariant)") {
|
||||
}
|
||||
|
||||
SECTION("stores Serialized<std::string> by copy") {
|
||||
var1.set(serialized(std::string("hello!!")));
|
||||
var1.set(serialized("hello!!"_s));
|
||||
spyingAllocator.clearLog();
|
||||
|
||||
var2.set(var1);
|
||||
@@ -117,7 +119,7 @@ TEST_CASE("JsonVariant::set(JsonVariant)") {
|
||||
}
|
||||
|
||||
SECTION("fails gracefully if raw string allocation fails") {
|
||||
var1.set(serialized(std::string("hello!!")));
|
||||
var1.set(serialized("hello!!"_s));
|
||||
killswitch.on();
|
||||
spyingAllocator.clearLog();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user