11#![ allow( clippy:: missing_safety_doc) ]
22
33use byondapi:: { byond_string, map:: * , prelude:: * } ;
4+ use eyre:: Result ;
45
56#[ test]
67fn generate_binds ( ) {
@@ -18,20 +19,20 @@ fn setup_panic_handler() {
1819}
1920
2021#[ byondapi:: bind]
21- fn test_connection ( ) {
22+ fn test_connection ( ) -> Result < ByondValue > {
2223 setup_panic_handler ( ) ;
2324 Ok ( ByondValue :: new_num ( 69.0 ) )
2425}
2526
2627#[ byondapi:: bind_raw_args]
27- fn test_args ( ) {
28+ fn test_args ( ) -> Result < ByondValue > {
2829 setup_panic_handler ( ) ;
2930 assert_eq ! ( args. len( ) , 2 ) ;
3031 Ok ( args[ 1 ] )
3132}
3233
3334#[ byondapi:: bind]
34- fn test_ptr ( ptr : ByondValue ) {
35+ fn test_ptr ( ptr : ByondValue ) -> Result < ByondValue > {
3536 setup_panic_handler ( ) ;
3637 let pointer = ByondValuePointer :: new ( ptr) ?;
3738
@@ -44,20 +45,20 @@ fn test_ptr(ptr: ByondValue) {
4445}
4546
4647#[ byondapi:: bind]
47- fn test_proc_call ( object : ByondValue ) {
48+ fn test_proc_call ( object : ByondValue ) -> Result < ByondValue > {
4849 Ok ( object. call ( "get_name" , & [ ] ) ?)
4950}
5051
5152#[ byondapi:: bind]
52- fn test_readwrite_var ( object : ByondValue ) {
53+ fn test_readwrite_var ( object : ByondValue ) -> Result < ByondValue > {
5354 setup_panic_handler ( ) ;
5455
5556 object. read_var_id ( byond_string ! ( "name" ) ) ?. get_string ( ) ?;
5657
5758 Ok ( object. read_string ( "name" ) ?. try_into ( ) ?)
5859}
5960#[ byondapi:: bind]
60- fn test_list_push ( mut list : ByondValue ) {
61+ fn test_list_push ( mut list : ByondValue ) -> Result < ByondValue > {
6162 setup_panic_handler ( ) ;
6263
6364 list. push_list ( ByondValue :: new_num ( 8.0 ) ) ?;
@@ -66,7 +67,7 @@ fn test_list_push(mut list: ByondValue) {
6667}
6768
6869#[ byondapi:: bind]
69- fn test_list_double ( list : ByondValue ) {
70+ fn test_list_double ( list : ByondValue ) -> Result < ByondValue > {
7071 setup_panic_handler ( ) ;
7172
7273 let collection = list
@@ -78,14 +79,14 @@ fn test_list_double(list: ByondValue) {
7879}
7980
8081#[ byondapi:: bind]
81- fn test_list_index ( list : ByondValue ) {
82+ fn test_list_index ( list : ByondValue ) -> Result < ByondValue > {
8283 setup_panic_handler ( ) ;
8384
8485 Ok ( list. read_list_index ( 3.0 ) ?)
8586}
8687
8788#[ byondapi:: bind]
88- fn test_list_pop ( mut list : ByondValue ) {
89+ fn test_list_pop ( mut list : ByondValue ) -> Result < ByondValue > {
8990 setup_panic_handler ( ) ;
9091
9192 let element = list. pop_list ( ) ?;
@@ -98,13 +99,13 @@ fn test_list_pop(mut list: ByondValue) {
9899}
99100
100101#[ byondapi:: bind]
101- fn test_length_with_list ( list : ByondValue ) {
102+ fn test_length_with_list ( list : ByondValue ) -> Result < ByondValue > {
102103 setup_panic_handler ( ) ;
103104 Ok ( list. builtin_length ( ) ?)
104105}
105106
106107#[ byondapi:: bind]
107- fn test_block ( ) {
108+ fn test_block ( ) -> Result < ByondValue > {
108109 setup_panic_handler ( ) ;
109110
110111 let block = byond_block (
@@ -123,13 +124,13 @@ fn test_block() {
123124}
124125
125126#[ byondapi:: bind]
126- fn test_length_with_str ( object : ByondValue ) {
127+ fn test_length_with_str ( object : ByondValue ) -> Result < ByondValue > {
127128 setup_panic_handler ( ) ;
128129
129130 Ok ( object. builtin_length ( ) ?)
130131}
131132#[ byondapi:: bind]
132- fn test_list_key_lookup ( mut list : ByondValue ) {
133+ fn test_list_key_lookup ( mut list : ByondValue ) -> Result < ByondValue > {
133134 setup_panic_handler ( ) ;
134135
135136 let num: f32 = list. read_list_index ( "cat" ) ?. try_into ( ) ?;
@@ -165,7 +166,7 @@ fn test_list_key_lookup(mut list: ByondValue) {
165166}
166167
167168#[ byondapi:: bind]
168- fn test_ref ( turf : ByondValue ) {
169+ fn test_ref ( turf : ByondValue ) -> Result < ByondValue > {
169170 setup_panic_handler ( ) ;
170171
171172 let turf_type = turf. get_type ( ) ;
@@ -177,7 +178,7 @@ fn test_ref(turf: ByondValue) {
177178}
178179
179180#[ byondapi:: bind]
180- fn test_non_assoc_list ( list : ByondValue ) {
181+ fn test_non_assoc_list ( list : ByondValue ) -> Result < ByondValue > {
181182 setup_panic_handler ( ) ;
182183
183184 let map = list
@@ -199,7 +200,7 @@ fn test_non_assoc_list(list: ByondValue) {
199200}
200201
201202#[ byondapi:: bind]
202- fn test_list_read ( list : ByondValue ) {
203+ fn test_list_read ( list : ByondValue ) -> Result < ByondValue > {
203204 setup_panic_handler ( ) ;
204205
205206 let map = list. get_list_values ( ) ?;
@@ -217,7 +218,7 @@ fn test_list_read(list: ByondValue) {
217218}
218219
219220#[ byondapi:: bind]
220- fn test_new_obj ( ) {
221+ fn test_new_obj ( ) -> Result < ByondValue > {
221222 Ok ( ByondValue :: builtin_new (
222223 ByondValue :: try_from ( "/datum/testobject" ) ?,
223224 & [ ] ,
0 commit comments