mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 10:17:39 +02:00
Add a test for #1922
This commit is contained in:
@ -152,3 +152,16 @@ TEST_CASE("ConverterNeedsWriteableRef") {
|
||||
CHECK(ConverterNeedsWriteableRef<JsonArray>::value == true);
|
||||
CHECK(ConverterNeedsWriteableRef<JsonArrayConst>::value == false);
|
||||
}
|
||||
|
||||
namespace ArduinoJson {
|
||||
void convertToJson(char c, JsonVariant var) {
|
||||
char buf[] = {c, 0};
|
||||
var.set(buf);
|
||||
}
|
||||
} // namespace ArduinoJson
|
||||
|
||||
TEST_CASE("Convert char to string") { // issue #1922
|
||||
StaticJsonDocument<64> doc;
|
||||
doc.set('a');
|
||||
REQUIRE(doc.as<std::string>() == "a");
|
||||
}
|
||||
|
Reference in New Issue
Block a user