@@ -16,15 +16,18 @@ mod test {
1616 use bevy_mod_scripting_derive:: script_bindings;
1717
1818 use crate :: {
19- bindings:: function:: {
20- from:: { Ref , Val } ,
21- namespace:: IntoNamespace ,
22- script_function:: AppScriptFunctionRegistry ,
19+ bindings:: {
20+ function:: {
21+ from:: { Ref , Val } ,
22+ namespace:: IntoNamespace ,
23+ script_function:: AppScriptFunctionRegistry ,
24+ } ,
25+ script_value:: ScriptValue ,
2326 } ,
24- error :: InteropError ,
27+ docgen :: typed_through :: TypedThrough ,
2528 } ;
2629
27- use super :: arg_meta:: { ScriptArgument , ScriptReturn } ;
30+ use super :: arg_meta:: { ScriptArgument , ScriptReturn , TypedScriptArgument , TypedScriptReturn } ;
2831
2932 #[ test]
3033 fn test_macro_generates_correct_registrator_function ( ) {
@@ -66,14 +69,14 @@ mod test {
6669 assert_eq ! ( test_fn. info. arg_info[ 1 ] . name, Some ( "_arg1" . into( ) ) ) ;
6770
6871 assert_eq ! (
69- test_fn. info. return_info. type_id,
72+ test_fn. info. return_info. as_ref ( ) . unwrap ( ) . type_id,
7073 std:: any:: TypeId :: of:: <( ) >( )
7174 ) ;
7275 }
7376
74- fn test_is_valid_return < T : ScriptReturn > ( ) { }
75- fn test_is_valid_arg < T : ScriptArgument > ( ) { }
76- fn test_is_valid_arg_and_return < T : ScriptArgument + ScriptReturn > ( ) { }
77+ fn test_is_valid_return < T : TypedScriptReturn > ( ) { }
78+ fn test_is_valid_arg < T : TypedScriptArgument > ( ) { }
79+ fn test_is_valid_arg_and_return < T : TypedScriptReturn + TypedScriptArgument > ( ) { }
7780
7881 #[ test]
7982 fn primitives_are_valid_args ( ) {
@@ -92,6 +95,7 @@ mod test {
9295 test_is_valid_arg_and_return :: < f64 > ( ) ;
9396 test_is_valid_arg_and_return :: < usize > ( ) ;
9497 test_is_valid_arg_and_return :: < isize > ( ) ;
98+ test_is_valid_arg_and_return :: < ScriptValue > ( ) ;
9599 }
96100
97101 #[ test]
@@ -100,14 +104,15 @@ mod test {
100104 test_is_valid_arg_and_return :: < std:: path:: PathBuf > ( ) ;
101105 test_is_valid_arg_and_return :: < std:: ffi:: OsString > ( ) ;
102106 test_is_valid_arg_and_return :: < char > ( ) ;
107+ test_is_valid_return :: < & ' static str > ( ) ;
103108 }
104109
105110 #[ test]
106111 fn composites_are_valid_args ( ) {
107112 fn test_val < T > ( )
108113 where
109114 T : ScriptArgument + ScriptReturn ,
110- T : GetTypeRegistration + FromReflect ,
115+ T : GetTypeRegistration + FromReflect + Typed ,
111116 {
112117 test_is_valid_arg_and_return :: < Val < T > > ( ) ;
113118 }
@@ -128,12 +133,10 @@ mod test {
128133 test_is_valid_arg :: < Ref < ' _ , T > > ( ) ;
129134 }
130135
131- test_is_valid_return :: < InteropError > ( ) ;
132-
133136 fn test_array < T , const N : usize > ( )
134137 where
135138 T : ScriptArgument + ScriptReturn ,
136- T : GetTypeRegistration + FromReflect + Typed ,
139+ T : GetTypeRegistration + FromReflect + TypedThrough + Typed ,
137140 for < ' a > T :: This < ' a > : Into < T > ,
138141 {
139142 test_is_valid_arg_and_return :: < [ T ; N ] > ( ) ;
@@ -142,7 +145,7 @@ mod test {
142145 fn test_tuple < T > ( )
143146 where
144147 T : ScriptArgument + ScriptReturn ,
145- T : GetTypeRegistration + FromReflect + Typed ,
148+ T : GetTypeRegistration + FromReflect + TypedThrough + Typed ,
146149 for < ' a > T :: This < ' a > : Into < T > ,
147150 {
148151 test_is_valid_arg_and_return :: < ( ) > ( ) ;
@@ -154,7 +157,7 @@ mod test {
154157 fn test_option < T > ( )
155158 where
156159 T : ScriptArgument + ScriptReturn ,
157- T : GetTypeRegistration + FromReflect + Typed ,
160+ T : GetTypeRegistration + FromReflect + Typed + TypedThrough ,
158161 for < ' a > T :: This < ' a > : Into < T > ,
159162 {
160163 test_is_valid_arg_and_return :: < Option < T > > ( ) ;
@@ -163,7 +166,7 @@ mod test {
163166 fn test_vec < T > ( )
164167 where
165168 T : ScriptArgument + ScriptReturn ,
166- T : GetTypeRegistration + FromReflect + Typed ,
169+ T : GetTypeRegistration + FromReflect + Typed + TypedThrough ,
167170 for < ' a > T :: This < ' a > : Into < T > ,
168171 {
169172 test_is_valid_arg_and_return :: < Vec < T > > ( ) ;
@@ -172,7 +175,7 @@ mod test {
172175 fn test_hashmap < V > ( )
173176 where
174177 V : ScriptArgument + ScriptReturn ,
175- V : GetTypeRegistration + FromReflect + Typed ,
178+ V : GetTypeRegistration + FromReflect + Typed + TypedThrough ,
176179 for < ' a > V :: This < ' a > : Into < V > ,
177180 {
178181 test_is_valid_arg_and_return :: < std:: collections:: HashMap < String , V > > ( ) ;
0 commit comments