forked from bblanchon/ArduinoJson
Add a test for #1922
This commit is contained in:
@ -152,3 +152,16 @@ TEST_CASE("ConverterNeedsWriteableRef") {
|
|||||||
CHECK(ConverterNeedsWriteableRef<JsonArray>::value == true);
|
CHECK(ConverterNeedsWriteableRef<JsonArray>::value == true);
|
||||||
CHECK(ConverterNeedsWriteableRef<JsonArrayConst>::value == false);
|
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