Sha256: ca1f20638160235bd1470836169f6a7ff354bad2dfc61742a426fd3f64c2724e

Contents?: true

Size: 478 Bytes

Versions: 4

Compression:

Stored size: 478 Bytes

Contents

use magnus::{prelude::*, RArray};

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/enumerator.rs
wasmtime-28.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/enumerator.rs
wasmtime-27.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/enumerator.rs
wasmtime-26.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/enumerator.rs