diff options
| author | dearblue <[email protected]> | 2019-01-03 17:15:04 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2019-01-03 18:16:26 +0900 |
| commit | fc20d0186dfa3a6bd72b4cf1e09a1497c50b536b (patch) | |
| tree | 50fdc002ec0ff6efbff5421a5585b203e6463ebb /mrbgems/mruby-proc-ext | |
| parent | 9a9e12a1299181bc38abbb4e8dbb62569bcbc551 (diff) | |
| download | mruby-fc20d0186dfa3a6bd72b4cf1e09a1497c50b536b.tar.gz mruby-fc20d0186dfa3a6bd72b4cf1e09a1497c50b536b.zip | |
Add test for #<< and #>> for Proc and Method class
Diffstat (limited to 'mrbgems/mruby-proc-ext')
| -rw-r--r-- | mrbgems/mruby-proc-ext/test/proc.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb index 3e64bc103..1220841c8 100644 --- a/mrbgems/mruby-proc-ext/test/proc.rb +++ b/mrbgems/mruby-proc-ext/test/proc.rb @@ -77,6 +77,19 @@ assert('Kernel#proc') do end end +assert "Proc#<< and Proc#>>" do + add3 = ->(n) { n + 3 } + mul2 = ->(n) { n * 2 } + + f1 = mul2 << add3 + assert_kind_of Proc, f1 + assert_equal 16, f1.call(5) + + f2 = mul2 >> add3 + assert_kind_of Proc, f2 + assert_equal 13, f2.call(5) +end + assert('mrb_proc_new_cfunc_with_env') do ProcExtTest.mrb_proc_new_cfunc_with_env(:test) ProcExtTest.mrb_proc_new_cfunc_with_env(:mruby) |
