Sha256: 0ad63f4852adcd91a40ffc1d95bb269e23bc338666acdc85a9516c492d5e1561

Contents?: true

Size: 990 Bytes

Versions: 11

Compression:

Stored size: 990 Bytes

Contents

use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;

#[wasm_bindgen_test]
fn entries() {
    let s = Set::new(&JsValue::undefined());
    s.add(&1.into());
    let iter = s.entries();
    let obj = iter.next().unwrap();
    assert!(!obj.done());
    let array = Array::from(&obj.value());
    assert_eq!(array.length(), 2);
    array.for_each(&mut |a, _, _| {
        assert_eq!(a, 1);
    });

    assert!(iter.next().unwrap().done());
}

#[wasm_bindgen_test]
fn keys() {
    let s = Set::new(&JsValue::undefined());
    s.add(&1.into());
    let iter = s.keys();
    let obj = iter.next().unwrap();
    assert!(!obj.done());
    assert_eq!(obj.value(), 1);
    assert!(iter.next().unwrap().done());
}

#[wasm_bindgen_test]
fn values() {
    let s = Set::new(&JsValue::undefined());
    s.add(&1.into());
    let iter = s.values();
    let obj = iter.next().unwrap();
    assert!(!obj.done());
    assert_eq!(obj.value(), 1);
    assert!(iter.next().unwrap().done());
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-22.0.0 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-21.0.1 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-20.0.2 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-20.0.0 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-18.0.3 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-17.0.1 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-17.0.0 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-16.0.0 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-15.0.1 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs
wasmtime-15.0.0 ./ext/cargo-vendor/js-sys-0.3.66/tests/wasm/SetIterator.rs