Sha256: 6b5e37db88481cb7d3748735bdfe671b75250c71788ed99d7573f0d295338e90

Contents?: true

Size: 663 Bytes

Versions: 19

Compression:

Stored size: 663 Bytes

Contents

use std::collections::HashMap;

#[test]
fn it_converts_hash_map() {
    let ruby = unsafe { magnus::embed::init() };

    let map: HashMap<String, u8> = ruby
        .eval(r#"{"foo" => 1, "bar" => 2, "baz" => 3}"#)
        .unwrap();

    let mut expected = HashMap::new();
    expected.insert("foo".to_owned(), 1);
    expected.insert("bar".to_owned(), 2);
    expected.insert("baz".to_owned(), 3);
    assert_eq!(expected, map);

    let mut map = HashMap::new();
    map.insert("test", (0, 0.5));
    map.insert("example", (1, 3.75));
    magnus::rb_assert!(
        ruby,
        r#"map == {"test" => [0, 0.5], "example" => [1, 3.75]}"#,
        map
    );
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/hash.rs
wasmtime-28.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/hash.rs
wasmtime-27.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/hash.rs
wasmtime-26.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/hash.rs
wasmtime-25.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-25.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-25.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-24.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-23.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-22.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-21.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-20.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-20.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/hash.rs
wasmtime-18.0.3 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs
wasmtime-17.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs
wasmtime-17.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs
wasmtime-16.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs
wasmtime-15.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs
wasmtime-15.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/hash.rs