mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Adding in unit tests for From impl
This commit is contained in:
parent
86937b9dba
commit
8cb9b88acb
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user