Sha256: 16ac749c783bffbc73fb402808d2c500eab554bc27fdcd1e3fcb935801e1689b

Contents?: true

Size: 665 Bytes

Versions: 19

Compression:

Stored size: 665 Bytes

Contents

use magnus::{eval, RArray};

#[test]
fn enumerator_impls_iterator() {
    let _cleanup = unsafe { magnus::embed::init() };
    let a: RArray = eval("[1,2,3]").unwrap();
    let mut e = a.each();
    assert_eq!(
        e.next()
            .unwrap()
            .and_then(|v| v.try_convert::<i64>())
            .unwrap(),
        1
    );
    assert_eq!(
        e.next()
            .unwrap()
            .and_then(|v| v.try_convert::<i64>())
            .unwrap(),
        2
    );
    assert_eq!(
        e.next()
            .unwrap()
            .and_then(|v| v.try_convert::<i64>())
            .unwrap(),
        3
    );
    assert!(e.next().is_none());
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wasmtime-14.0.4 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-14.0.3 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-14.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-14.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-13.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-12.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-12.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-11.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-10.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-10.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-9.0.4 ./ext/cargo-vendor/magnus-0.5.5/tests/enumerator.rs
wasmtime-9.0.1 ./ext/cargo-vendor/magnus-0.5.3/tests/enumerator.rs
wasmtime-8.0.0 ./ext/cargo-vendor/magnus-0.5.3/tests/enumerator.rs
wasmtime-7.0.0 ./ext/cargo-vendor/magnus-0.5.2/tests/enumerator.rs
wasmtime-6.0.1 ./ext/cargo-vendor/magnus-0.5.1/tests/enumerator.rs
wasmtime-6.0.0 ./ext/cargo-vendor/magnus-0.5.1/tests/enumerator.rs
wasmtime-5.0.0 ./ext/cargo-vendor/magnus-0.4.4/tests/enumerator.rs
wasmtime-0.4.1 ./ext/cargo-vendor/magnus-0.4.4/tests/enumerator.rs
wasmtime-0.4.0 ./ext/cargo-vendor/magnus-0.4.3/tests/enumerator.rs