Add more tests with VLAs

This commit is contained in:
Benoit Blanchon
2024-11-07 14:19:47 +01:00
parent 1110d62128
commit 31253dbe13
7 changed files with 160 additions and 2 deletions

View File

@ -46,6 +46,18 @@ TEST_CASE("JsonVariant::add(T)") {
REQUIRE(var.as<std::string>() == "{\"val\":123}");
}
#ifdef HAS_VARIABLE_LENGTH_ARRAY
SECTION("supports VLAs") {
size_t i = 16;
char vla[i];
strcpy(vla, "hello");
var.add(vla);
REQUIRE(var.as<std::string>() == "[\"hello\"]");
}
#endif
}
TEST_CASE("JsonVariant::add<T>()") {