Sha256: 26ca5900f9eec2be2c12d49b0a6a3ef90d9b2494777aac6a17288948250715b0

Contents?: true

Size: 638 Bytes

Versions: 19

Compression:

Stored size: 638 Bytes

Contents

use magnus::{block::block_proc, define_global_function, function};

macro_rules! rb_assert {
    ($s:literal) => {
        assert!(magnus::eval::<bool>($s).unwrap())
    };
    ($s:literal, $($rest:tt)*) => {
        let result: bool = magnus::eval!($s, $($rest)*).unwrap();
        assert!(result)
    };
}

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

    define_global_function("make_proc", function!(block_proc, 0));

    rb_assert!("Proc === make_proc { 1 + 1 }");
    rb_assert!("(make_proc { 1 + 1 }).call == 2");
    rb_assert!("begin; make_proc; rescue => e; end; ArgumentError === e");
}

Version data entries

19 entries across 19 versions & 1 rubygems

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