diff --git a/crates/js-sys/tests/wasm/TypedArray.rs b/crates/js-sys/tests/wasm/TypedArray.rs index da84d092..712541a4 100644 --- a/crates/js-sys/tests/wasm/TypedArray.rs +++ b/crates/js-sys/tests/wasm/TypedArray.rs @@ -111,6 +111,16 @@ fn view() { }); } +#[wasm_bindgen_test] +fn from() { + let x: Vec = vec![1, 2, 3]; + let array = Int32Array::from(x.as_slice()); + assert_eq!(array.length(), 3); + array.for_each(&mut |x, i, _| { + assert_eq!(x, (i + 1) as i32); + }); +} + #[wasm_bindgen_test] fn copy_to() { let mut x = [0; 10];