mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-18 15:31:25 +00:00
Adding in unit tests for From impl
This commit is contained in:
@ -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]
|
#[wasm_bindgen_test]
|
||||||
fn copy_to() {
|
fn copy_to() {
|
||||||
let mut x = [0; 10];
|
let mut x = [0; 10];
|
||||||
|
Reference in New Issue
Block a user