Skip to content

Commit 264538b

Browse files
committed
Test ElementProxy::add()
1 parent b4ca901 commit 264538b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

extras/tests/JsonDocument/ElementProxy.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,25 @@ TEST_CASE("ElementProxy::add()") {
2626
REQUIRE(doc.as<std::string>() == "[[\"world\"]]");
2727
}
2828

29-
SECTION("set(char[])") {
29+
SECTION("add(char[])") {
3030
char s[] = "world";
3131
ep.add(s);
3232
strcpy(s, "!!!!!");
3333

3434
REQUIRE(doc.as<std::string>() == "[[\"world\"]]");
3535
}
36+
37+
#ifdef HAS_VARIABLE_LENGTH_ARRAY
38+
SECTION("set(vla)") {
39+
size_t i = 8;
40+
char vla[i];
41+
strcpy(vla, "world");
42+
43+
ep.add(vla);
44+
45+
REQUIRE(doc.as<std::string>() == "[[\"world\"]]");
46+
}
47+
#endif
3648
}
3749

3850
TEST_CASE("ElementProxy::clear()") {

0 commit comments

Comments
 (0)