js-sys: add bindings for regexp.lastIndex

This commit is contained in:
Nick Fitzgerald
2018-08-10 13:14:54 -07:00
parent dc028d38c8
commit 178a5e89df
2 changed files with 23 additions and 0 deletions

View File

@ -56,6 +56,15 @@ fn input() {
assert_eq!(RegExp::input(), "hi there!");
}
#[wasm_bindgen_test]
fn last_index() {
let re = RegExp::new("hi", "g");
assert_eq!(re.last_index(), 0);
re.set_last_index(42);
assert_eq!(re.last_index(), 42);
}
#[wasm_bindgen_test]
fn last_match() {
let re = RegExp::new("hi", "g");