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