Skip to content

Commit a9dea47

Browse files
lukaslihotzkidaxpedda
authored andcommitted
Fix TODO with get_index/set_index
1 parent 2b03f6e commit a9dea47

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

crates/js-sys/tests/wasm/DataView.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use wasm_bindgen_test::*;
77
fn test() {
88
let bytes = Int8Array::new(&JsValue::from(10));
99

10-
// TODO: figure out how to do `bytes[2] = 2`
11-
bytes.subarray(2, 3).fill(2, 0, 1);
10+
bytes.set_index(2, 2);
1211

1312
let v = DataView::new(&bytes.buffer(), 2, 8);
1413
assert_eq!(v.byte_offset(), 2);
@@ -63,18 +62,14 @@ fn test() {
6362

6463
v.set_int8(0, 42);
6564

66-
// TODO: figure out how to do `bytes[2]`
67-
bytes
68-
.subarray(2, 3)
69-
.for_each(&mut |x, _, _| assert_eq!(x, 42));
65+
assert_eq!(bytes.get_index(2), 42);
7066
}
7167

7268
#[wasm_bindgen_test]
7369
fn dataview_inheritance() {
7470
let bytes = Int8Array::new(&JsValue::from(10));
7571

76-
// TODO: figure out how to do `bytes[2] = 2`
77-
bytes.subarray(2, 3).fill(2, 0, 1);
72+
bytes.set_index(2, 2);
7873

7974
let v = DataView::new(&bytes.buffer(), 2, 8);
8075

0 commit comments

Comments
 (0)