Skip to content

Commit

Permalink
Restore compatibility with wasm-bindgen test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
koute committed Oct 7, 2019
1 parent 7ffa8a3 commit 3b35522
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/webcore/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,14 @@ mod test {

/// This duplicates and tests the example in `Object::to_iter` documentation.
#[test]
fn test_object_to_iter() -> Result< (), Box< dyn std::error::Error > > {
let obj: Object = js!( return { [1]: 2 } ).try_into()?;
fn test_object_to_iter() {
let obj: Object = js!( return { [1]: 2 } ).try_into().unwrap();

let map: HashMap< i32, i32 > = obj
.to_iter()
.map( |(k, v)| Ok( ( k.parse()?, v.try_into()? ) ) )
.collect::< Result< _, Box< dyn std::error::Error > > >()?;
.collect::< Result< _, Box< dyn std::error::Error > > >().unwrap();

assert_eq!( map[ &1 ], 2 );

Ok( () )
}
}

0 comments on commit 3b35522

Please sign in to comment.