@@ -133,6 +133,7 @@ pub use secp256k1_sys as ffi;
133133#[ cfg( all( test, feature = "serde" ) ) ] extern crate serde_test;
134134#[ cfg( any( test, feature = "rand" ) ) ] use rand:: Rng ;
135135#[ cfg( any( test, feature = "std" ) ) ] extern crate core;
136+ #[ cfg( all( test, target_arch = "wasm32" ) ) ] extern crate wasm_bindgen_test;
136137
137138use core:: { fmt, ptr, str} ;
138139
@@ -770,6 +771,9 @@ mod tests {
770771 use ffi:: { self , types:: AlignedType } ;
771772 use context:: * ;
772773
774+ #[ cfg( target_arch = "wasm32" ) ]
775+ use wasm_bindgen_test:: wasm_bindgen_test as test;
776+
773777 macro_rules! hex {
774778 ( $hex: expr) => ( {
775779 let mut result = vec![ 0 ; $hex. len( ) / 2 ] ;
@@ -840,6 +844,7 @@ mod tests {
840844 drop ( ctx_vrfy) ;
841845 }
842846
847+ #[ cfg( not( target_arch = "wasm32" ) ) ]
843848 #[ test]
844849 #[ should_panic]
845850 fn test_panic_raw_ctx ( ) {
@@ -1134,33 +1139,6 @@ mod tests {
11341139 assert ! ( SECP256K1 . verify( & msg, & sig, & pk) . is_ok( ) ) ;
11351140 }
11361141
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-
11641142 #[ cfg( feature = "bitcoin_hashes" ) ]
11651143 #[ test]
11661144 fn test_from_hash ( ) {
0 commit comments