Merge pull request #68747 from rune-scape/rune-stringname-unification

GDScript: Unify StringName and String
This commit is contained in:
Rémi Verschelde
2022-12-09 18:06:48 +01:00
28 changed files with 1450 additions and 254 deletions

View File

@@ -64,6 +64,19 @@ TEST_CASE("[Dictionary] Assignment using bracket notation ([])") {
map["World!"] = 4;
CHECK(int(map["World!"]) == 4);
map[StringName("HelloName")] = 6;
CHECK(int(map[StringName("HelloName")]) == 6);
// Check that StringName key is converted to String.
CHECK(int(map.find_key(6).get_type()) == Variant::STRING);
map[StringName("HelloName")] = 7;
CHECK(int(map[StringName("HelloName")]) == 7);
// Test String and StringName are equivalent.
map[StringName("Hello")] = 8;
CHECK(int(map["Hello"]) == 8);
map["Hello"] = 9;
CHECK(int(map[StringName("Hello")]) == 9);
// Test non-string keys, since keys can be of any Variant type.
map[12345] = -5;
CHECK(int(map[12345]) == -5);