Sha256: 9b75c9ad6bbdc6b70d530351f444d44d3c84d87f7f2ee246737f517085c8b779

Contents?: true

Size: 709 Bytes

Versions: 19

Compression:

Stored size: 709 Bytes

Contents

use magnus::{prelude::*, rb_assert, Value};

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

    assert!(ruby.eval::<Value>(r#"42"#).unwrap().is_frozen());
    assert!(ruby.eval::<Value>(r#":foo"#).unwrap().is_frozen());

    assert!(!ruby.eval::<Value>(r#"Object.new"#).unwrap().is_frozen());
    assert!(!ruby.eval::<Value>(r#"[1]"#).unwrap().is_frozen());

    assert!(ruby
        .eval::<Value>(r#"Object.new.freeze"#)
        .unwrap()
        .is_frozen());
    assert!(ruby.eval::<Value>(r#"[1].freeze"#).unwrap().is_frozen());

    let val = ruby.ary_new();
    rb_assert!(ruby, "!val.frozen?", val);
    val.freeze();
    rb_assert!(ruby, "val.frozen?", val);
}

Version data entries

19 entries across 19 versions & 1 rubygems

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