Allow using a JsonVariant as a key or index

Closes #2080
This commit is contained in:
Benoit Blanchon
2024-05-14 21:06:02 +02:00
parent 071f718473
commit 68a13117dc
26 changed files with 393 additions and 34 deletions

View File

@ -164,4 +164,13 @@ TEST_CASE("JsonArray::operator[]") {
REQUIRE(std::string("world") == array[0]);
}
#endif
SECTION("Use a JsonVariant as index") {
array[0] = 1;
array[1] = 2;
array[2] = 3;
REQUIRE(array[array[1]] == 3);
REQUIRE(array[array[3]] == nullptr);
}
}