File tree 3 files changed +45
-2
lines changed
godot-core/src/builtin/meta 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ macro_rules! impl_signature_for_tuple {
162
162
unsafe { <$R as sys:: GodotFuncMarshal >:: try_write_sys( & ret_val, ret) }
163
163
. unwrap_or_else( |e| return_error:: <$R>( method_name, & e) ) ;
164
164
165
- // FIXME is inc_ref needed here?
166
- // std::mem::forget(ret_val);
165
+ //Note: we want to prevent the destructor from being run, since we pass ownership to the caller.
166
+ // For details look at https://github.com/godot-rust/gdext/pull/165
167
+ std:: mem:: forget( ret_val) ;
167
168
}
168
169
}
169
170
} ;
Original file line number Diff line number Diff line change
1
+ extends ArrayTest
2
+
3
+ var _assertion_failed : bool = false
4
+
5
+ ## Asserts that `what` is `true`, but does not abort the test. Returns `what` so you can return
6
+ ## early from the test function if the assertion failed.
7
+ func assert_that (what : bool , message : String = "" ) -> bool :
8
+ if what :
9
+ return true
10
+
11
+ _assertion_failed = true
12
+ if message :
13
+ print ("assertion failed: %s " % message )
14
+ else :
15
+ print ("assertion failed" )
16
+ return false
17
+
18
+ func assert_eq (left , right , message : String = "" ) -> bool :
19
+ if left == right :
20
+ return true
21
+
22
+ _assertion_failed = true
23
+ if message :
24
+ print ("assertion failed: %s \n left: %s \n right: %s " % [message , left , right ])
25
+ else :
26
+ print ("assertion failed: `(left == right)`\n left: %s \n right: %s " % [left , right ])
27
+ return false
28
+
29
+
30
+
31
+ # Called when the node enters the scene tree for the first time.
32
+ func _ready ():
33
+ pass
34
+
35
+ func test_vector_array_return_from_user_func ():
36
+ var array : Array = return_typed_array (2 )
37
+ assert_eq (array , [1 ,2 ])
38
+
39
+ # Called every frame. 'delta' is the elapsed time since the previous frame.
40
+ func _process (delta ):
41
+ pass
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ func _ready():
9
9
10
10
var gdscript_suites : Array = [
11
11
preload ("res://ManualFfiTests.gd" ).new (),
12
+ preload ("res://InheritTests.gd" ).new (),
12
13
preload ("res://gen/GenFfiTests.gd" ).new (),
13
14
]
14
15
You can’t perform that action at this time.
0 commit comments