Sha256: bac10083f326fec4abfb952e7c2aa6e2ff499d8a8252708cfe6f89eda3d62af3

Contents?: true

Size: 493 Bytes

Versions: 19

Compression:

Stored size: 493 Bytes

Contents

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

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

    let val: RObject = eval!(ruby, "$val = Object.new").unwrap();

    val.ivar_set("@test", 42).unwrap();

    rb_assert!(ruby, "val.instance_variable_get(:@test) == 42", val);

    let _: Value = eval!(ruby, r#"val.instance_variable_set(:@example, "test")"#, val).unwrap();

    assert_eq!("test", val.ivar_get::<_, String>("@example").unwrap())
}

Version data entries

19 entries across 19 versions & 1 rubygems

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