Adding in unit tests for From impl

This commit is contained in:
Pauan 2019-06-24 18:09:36 +02:00
parent 86937b9dba
commit 8cb9b88acb

View File

@ -111,6 +111,16 @@ fn view() {
});
}
#[wasm_bindgen_test]
fn from() {
let x: Vec<i32> = 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];