Files
ArduinoJson/extras/tests/Misc/issue2181.cpp
Benoit Blanchon f051f8328d Undef true and false macros
Replacing `true` with `1` changes `JsonString("ABC", true)` into `JsonString("ABC", 1)`, so all static strings had a length of 1.

This is a workaround for arduino/ArduinoCore-sam#50
Fixes #2181
2025-06-19 13:59:15 +02:00

16 lines
319 B
C++

// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2025, Benoit BLANCHON
// MIT License
#define true 0x1
#define false 0x0
#include <ArduinoJson.h>
#include <catch.hpp>
TEST_CASE("Issue #2181") {
JsonDocument doc;
doc["hello"] = "world";
REQUIRE(doc.as<std::string>() == "{\"hello\":\"world\"}");
}