@ -174,11 +174,15 @@ fn build_with_and_without_wasm_bindgen_debug() {
#[ wasm_bindgen ]
#[ wasm_bindgen ]
impl MyThing {
impl MyThing {
#[ wasm_bindgen(constructor) ]
pub fn new ( ) -> MyThing {
pub fn new ( ) -> MyThing {
MyThing { }
MyThing { }
}
}
}
pub fn take ( self ) { }
#[ wasm_bindgen ]
pub fn take ( foo : MyThing ) {
drop ( foo ) ;
}
}
" #,
" #,
)
)
@ -192,10 +196,14 @@ fn build_with_and_without_wasm_bindgen_debug() {
. success ( ) ;
. success ( ) ;
let contents = fs ::read_to_string ( fixture . path . join ( "pkg/whatever.js" ) ) . unwrap ( ) ;
let contents = fs ::read_to_string ( fixture . path . join ( "pkg/whatever.js" ) ) . unwrap ( ) ;
let contains_move_assertions =
contents . contains ( "throw new Error('Attempt to use a moved value')" ) ;
assert_eq! (
assert_eq! (
contents . contains ( "throw new Error('Attempt to use a moved value')" ) ,
contains_move_assertions , debug ,
debug ,
" Should contain moved value assertions iff debug assertions are enabled . \
"Should only contain moved value assertions when debug assertions are enabled"
Contains move assertions ? { } . \
Is a debug JS glue build ? { } . " ,
contains_move_assertions , debug ,
) ;
) ;
}
}
}
}