1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #74730 from MarioLiebisch/fix-74726

Fix read-only dictionaries adding missing keys
This commit is contained in:
Rémi Verschelde
2023-06-19 21:38:38 +02:00
2 changed files with 15 additions and 2 deletions

View File

@@ -88,6 +88,12 @@ TEST_CASE("[Dictionary] Assignment using bracket notation ([])") {
CHECK(int(map[0]) == 400);
// Check that assigning 0 doesn't overwrite the value for `false`.
CHECK(int(map[false]) == 128);
// Ensure read-only maps aren't modified by non-existing keys.
const auto length = map.size();
map.make_read_only();
CHECK(int(map["This key does not exist"].get_type()) == Variant::NIL);
CHECK(map.size() == length);
}
TEST_CASE("[Dictionary] get_key_lists()") {