initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
37
modules/gdscript/tests/scripts/parser/features/dictionary.gd
Normal file
37
modules/gdscript/tests/scripts/parser/features/dictionary.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
func test():
|
||||
# Non-string keys are valid.
|
||||
print({ 12: "world" }[12])
|
||||
|
||||
var contents = {
|
||||
0: "zero",
|
||||
0.0: "zero point zero",
|
||||
null: "null",
|
||||
false: "false",
|
||||
[]: "empty array",
|
||||
Vector2i(): "zero Vector2i",
|
||||
15: {
|
||||
22: {
|
||||
4: ["nesting", "arrays"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
print(contents[0.0])
|
||||
# Making sure declaration order doesn't affect things...
|
||||
print({ 0.0: "zero point zero", 0: "zero", null: "null", false: "false", []: "empty array" }[0])
|
||||
print({ 0.0: "zero point zero", 0: "zero", null: "null", false: "false", []: "empty array" }[0.0])
|
||||
|
||||
print(contents[null])
|
||||
print(contents[false])
|
||||
print(contents[[]])
|
||||
print(contents[Vector2i()])
|
||||
print(contents[15])
|
||||
print(contents[15][22])
|
||||
print(contents[15][22][4])
|
||||
print(contents[15][22][4][0])
|
||||
print(contents[15][22][4][1])
|
||||
|
||||
# Currently fails with "invalid get index 'hello' on base Dictionary".
|
||||
# Both syntaxes are valid however.
|
||||
#print({ "hello": "world" }["hello"])
|
||||
#print({ "hello": "world" }.hello)
|
Reference in New Issue
Block a user