Adds Array.prototype.splice() to js-sys (#571)

This commit is contained in:
Joel Gallant
2018-07-27 11:07:21 -06:00
committed by Alex Crichton
parent 66649018ae
commit 01194558bf
2 changed files with 16 additions and 0 deletions

View File

@ -96,6 +96,15 @@ fn slice() {
assert_eq!(to_rust(&subset), array!["c", "x"]);
}
#[wasm_bindgen_test]
fn splice() {
let characters = js_array!["a", "c", "x", "n", 1, "8"];
let removed = characters.splice(1, 3, &"b".into());
assert_eq!(to_rust(&removed), array!["c", "x", "n"]);
assert_eq!(to_rust(&characters), array!["a", "b", 1, "8"]);
}
#[wasm_bindgen_test]
fn fill() {
let characters = js_array!["a", "c", "x", "n", 1, "8"];