Skip to content

Commit c190d78

Browse files
committed
Add test for non-existent property
1 parent 5e9a5a1 commit c190d78

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

test/gdscript_tests/lua_files/test_class.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local TestClass = {}
22

33
TestClass.some_signal = signal("arg1", "arg2")
4+
45
TestClass.empty_array = property { type = Array }
56
TestClass.preinitialized_array = Array { 1, 2, 3 }
67

test/gdscript_tests/test_class.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func test_signal() -> bool:
2020
var obj = test_class.new()
2121
assert(obj.some_signal is Signal, "Object should have signal defined in script")
2222
obj.some_signal.connect(_handle_signal)
23+
assert(not _signal_handled)
2324
obj.send_signal()
2425
assert(_signal_handled, "Signal was not handled")
2526
return true;
@@ -36,6 +37,12 @@ func test_array_properties() -> bool:
3637
return true
3738

3839

40+
func test_non_existent_property() -> bool:
41+
var obj = test_class.new()
42+
assert("some crazy non-existent property name" not in obj)
43+
return true;
44+
45+
3946
func test_property_getter_function() -> bool:
4047
var obj = test_class.new()
4148
assert(obj.getter_counter == 1)

0 commit comments

Comments
 (0)