@@ -133,6 +133,7 @@ pub use secp256k1_sys as ffi;
133
133
#[ cfg( all( test, feature = "serde" ) ) ] extern crate serde_test;
134
134
#[ cfg( any( test, feature = "rand" ) ) ] use rand:: Rng ;
135
135
#[ cfg( any( test, feature = "std" ) ) ] extern crate core;
136
+ #[ cfg( all( test, target_arch = "wasm32" ) ) ] extern crate wasm_bindgen_test;
136
137
137
138
use core:: { fmt, ptr, str} ;
138
139
@@ -770,6 +771,9 @@ mod tests {
770
771
use ffi:: { self , types:: AlignedType } ;
771
772
use context:: * ;
772
773
774
+ #[ cfg( target_arch = "wasm32" ) ]
775
+ use wasm_bindgen_test:: wasm_bindgen_test as test;
776
+
773
777
macro_rules! hex {
774
778
( $hex: expr) => ( {
775
779
let mut result = vec![ 0 ; $hex. len( ) / 2 ] ;
@@ -840,6 +844,7 @@ mod tests {
840
844
drop ( ctx_vrfy) ;
841
845
}
842
846
847
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
843
848
#[ test]
844
849
#[ should_panic]
845
850
fn test_panic_raw_ctx ( ) {
@@ -1134,33 +1139,6 @@ mod tests {
1134
1139
assert ! ( SECP256K1 . verify( & msg, & sig, & pk) . is_ok( ) ) ;
1135
1140
}
1136
1141
1137
- // For WASM, just run through our general tests in this file all at once.
1138
- #[ cfg( target_arch = "wasm32" ) ]
1139
- extern crate wasm_bindgen_test;
1140
- #[ cfg( target_arch = "wasm32" ) ]
1141
- use self :: wasm_bindgen_test:: * ;
1142
- #[ cfg( target_arch = "wasm32" ) ]
1143
- #[ wasm_bindgen_test]
1144
- fn stuff ( ) {
1145
- test_manual_create_destroy ( ) ;
1146
- test_raw_ctx ( ) ;
1147
- // Note that, sadly, WASM doesn't currently properly unwind panics, so use of the library
1148
- // via unsafe primitives may cause abort() instead of catch-able panics.
1149
- /*assert!(std::panic::catch_unwind(|| {
1150
- test_panic_raw_ctx();
1151
- }).is_err());*/
1152
- test_preallocation ( ) ;
1153
- capabilities ( ) ;
1154
- signature_serialize_roundtrip ( ) ;
1155
- signature_display ( ) ;
1156
- signature_lax_der ( ) ;
1157
- sign_and_verify ( ) ;
1158
- sign_and_verify_extreme ( ) ;
1159
- sign_and_verify_fail ( ) ;
1160
- test_bad_slice ( ) ;
1161
- test_low_s ( ) ;
1162
- }
1163
-
1164
1142
#[ cfg( feature = "bitcoin_hashes" ) ]
1165
1143
#[ test]
1166
1144
fn test_from_hash ( ) {
0 commit comments