File: call_proc.rs

package info (click to toggle)
rust-magnus 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,468 kB
  • sloc: ruby: 150; sh: 17; makefile: 2
file content (9 lines) | stat: -rw-r--r-- 213 bytes parent folder | download
1
2
3
4
5
6
7
8
9
use magnus::block::Proc;

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

    let p: Proc = ruby.eval("Proc.new {|i| i + 1}").unwrap();
    assert_eq!(43, p.call((42,)).unwrap());
}