@@ -82,7 +82,7 @@ pub fn wasm_bindgen_test(
82
82
83
83
let mut tokens = Vec :: < TokenTree > :: new ( ) ;
84
84
85
- let should_panic = match should_panic {
85
+ let should_panic_par = match & should_panic {
86
86
Some ( Some ( lit) ) => {
87
87
quote ! { :: core:: option:: Option :: Some ( :: core:: option:: Option :: Some ( #lit) ) }
88
88
}
@@ -99,9 +99,9 @@ pub fn wasm_bindgen_test(
99
99
} ;
100
100
101
101
let test_body = if attributes. r#async {
102
- quote ! { cx. execute_async( test_name, #ident, #should_panic , #ignore) ; }
102
+ quote ! { cx. execute_async( test_name, #ident, #should_panic_par , #ignore) ; }
103
103
} else {
104
- quote ! { cx. execute_sync( test_name, #ident, #should_panic , #ignore) ; }
104
+ quote ! { cx. execute_sync( test_name, #ident, #should_panic_par , #ignore) ; }
105
105
} ;
106
106
107
107
// We generate a `#[no_mangle]` with a known prefix so the test harness can
@@ -127,6 +127,18 @@ pub fn wasm_bindgen_test(
127
127
tokens. extend (
128
128
quote ! { #[ cfg_attr( not( all( target_arch = "wasm32" , target_os = "unknown" ) ) , #path) ] } ,
129
129
) ;
130
+
131
+ if let Some ( should_panic) = should_panic {
132
+ let should_panic = if let Some ( lit) = should_panic {
133
+ quote ! { should_panic = #lit }
134
+ } else {
135
+ quote ! { should_panic }
136
+ } ;
137
+
138
+ tokens. extend (
139
+ quote ! { #[ cfg_attr( not( all( target_arch = "wasm32" , target_os = "unknown" ) ) , #should_panic) ] }
140
+ )
141
+ }
130
142
}
131
143
132
144
tokens. extend ( leading_tokens) ;
0 commit comments