@@ -149,19 +149,25 @@ fn dynamic_call_with_panic() {
149
149
assert_eq ! ( call_error. class_name( ) , Some ( "Object" ) ) ;
150
150
assert_eq ! ( call_error. method_name( ) , "call" ) ;
151
151
152
- #[ cfg( target_os = "windows" ) ]
153
- let path = "itest\\ rust\\ src\\ object_tests\\ object_test.rs" ;
154
- #[ cfg( not( target_os = "windows" ) ) ]
155
- let path = "itest/rust/src/object_tests/object_test.rs" ;
152
+ let appendix = if cfg ! ( debug_assertions) {
153
+ let mut path = "itest/rust/src/object_tests/object_test.rs" . to_string ( ) ;
156
154
157
- // Obtain line number dynamically, avoids tedious maintenance on code reorganization.
158
- let line = ObjPayload :: get_panic_line ( ) ;
155
+ if cfg ! ( target_os = "windows" ) {
156
+ path = path. replace ( '/' , "\\ " )
157
+ }
158
+
159
+ // Obtain line number dynamically, avoids tedious maintenance on code reorganization.
160
+ let line = ObjPayload :: get_panic_line ( ) ;
161
+
162
+ format ! ( "\n at {path}:{line}" )
163
+ } else {
164
+ String :: new ( )
165
+ } ;
159
166
160
167
let expected_error_message = format ! (
161
168
"godot-rust function call failed: Object::call(&\" do_panic\" )\
162
169
\n Source: ObjPayload::do_panic()\
163
- \n Reason: [panic] do_panic exploded\
164
- \n at {path}:{line}"
170
+ \n Reason: [panic] do_panic exploded{appendix}"
165
171
) ;
166
172
167
173
assert_eq ! ( call_error. to_string( ) , expected_error_message) ;
0 commit comments