mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 13:01:22 +00:00
@ -1,5 +1,6 @@
|
||||
use wasm_bindgen::JsValue;
|
||||
use wasm_bindgen_test::*;
|
||||
use wasm_bindgen::JsCast;
|
||||
use js_sys::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
@ -37,3 +38,16 @@ fn test() {
|
||||
// TODO: figure out how to do `bytes[2]`
|
||||
bytes.subarray(2, 3).for_each(&mut |x, _, _| assert_eq!(x, 42));
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn dataview_inheritance() {
|
||||
let bytes = Int8Array::new(&JsValue::from(10));
|
||||
|
||||
// TODO: figure out how to do `bytes[2] = 2`
|
||||
bytes.subarray(2, 3).fill(2, 0, 1);
|
||||
|
||||
let v = DataView::new(&bytes.buffer(), 2, 8);
|
||||
|
||||
assert!(v.is_instance_of::<DataView>());
|
||||
assert!(v.is_instance_of::<Object>());
|
||||
}
|
||||
|
Reference in New Issue
Block a user