@@ -92,9 +92,8 @@ func test_export_dyn_gd_should_fail_for_wrong_type():
92
92
var dyn_gd_exporter = RefcDynGdVarDeclarer.new()
93
93
var refc = RefcHealth.new()
94
94
95
- disable_error_messages()
96
- dyn_gd_exporter.second = refc # Should fail.
97
- enable_error_messages()
95
+ expect_fail()
96
+ dyn_gd_exporter.second = refc # Causes current function to fail. Following code unreachable.
98
97
99
98
assert_fail(" `DynGdExporter.second` should only accept NodeHealth and only if it implements `InstanceIdProvider` trait" )
100
99
@@ -310,19 +309,19 @@ func test_custom_property_wrong_values_1():
310
309
return
311
310
312
311
var has_property: HasCustomProperty = HasCustomProperty.new()
313
- disable_error_messages ()
314
- has_property.some_c_style_enum = 10 # Should fail.
315
- enable_error_messages()
312
+ expect_fail ()
313
+ has_property.some_c_style_enum = 10 # Causes current function to fail. Following code unreachable .
314
+
316
315
assert_fail(" HasCustomProperty.some_c_style_enum should only accept integers in the range `(0 ..= 2)`" )
317
316
318
317
func test_custom_property_wrong_values_2():
319
318
if runs_release():
320
319
return
321
320
322
321
var has_property: HasCustomProperty = HasCustomProperty.new()
323
- disable_error_messages ()
324
- has_property.not_exportable = { " a" : " hello" , " b" : Callable()} # Should fail.
325
- enable_error_messages()
322
+ expect_fail ()
323
+ has_property.not_exportable = { " a" : " hello" , " b" : Callable()} # Causes current function to fail. Following code unreachable .
324
+
326
325
assert_fail(" HasCustomProperty.not_exportable should only accept dictionaries with float values" )
327
326
328
327
func test_option_export():
@@ -492,25 +491,39 @@ func test_renamed_func_get_set():
492
491
# Store arguments as Variant, as GDScript wouldn't parse script otherwise. Results in varcall being used.
493
492
494
493
func test_marshalling_fail_variant_type():
494
+ if runs_release():
495
+ return
496
+
495
497
# Expects Object, pass GString.
496
498
var obj := ObjectTest.new()
497
499
var arg: Variant = " not an object"
498
- obj.pass_object(arg)
500
+ expect_fail()
501
+ obj.pass_object(arg) # Causes current function to fail. Following code unreachable.
499
502
500
503
assert_fail(" GDScript function should fail after marshalling error (bad variant type)" )
501
504
502
505
func test_marshalling_fail_non_null():
506
+ if runs_release():
507
+ return
508
+
503
509
# Expects Object, pass null.
504
510
var obj := ObjectTest.new()
505
- obj.pass_object(null)
511
+
512
+ expect_fail()
513
+ obj.pass_object(null) # Causes current function to fail. Following code unreachable.
506
514
507
515
assert_fail(" GDScript function should fail after marshalling error (required non-null)" )
508
516
509
517
func test_marshalling_fail_integer_overflow():
518
+ if runs_release():
519
+ return
520
+
510
521
# Expects i32. This overflows.
511
522
var obj := ObjectTest.new()
512
523
var arg: Variant = 9223372036854775807
513
- obj.pass_i32(arg)
524
+
525
+ expect_fail()
526
+ obj.pass_i32(arg) # Causes current function to fail. Following code unreachable.
514
527
515
528
assert_fail(" GDScript function should fail after marshalling error (int overflow)" )
516
529
@@ -519,7 +532,7 @@ func test_marshalling_continues_on_panic():
519
532
520
533
# Expects i32. This overflows.
521
534
var obj := ObjectTest.new()
522
- var result = obj.cause_panic()
535
+ var result = obj.cause_panic() # Fails in Rust, current function continues.
523
536
524
537
assert_eq(result, Vector3.ZERO, " Default value returned on failed function call" )
525
538
mark_test_succeeded()
0 commit comments