diff options
| author | Francois Chagnon <[email protected]> | 2016-11-14 16:49:45 -0500 |
|---|---|---|
| committer | Bouke van der Bijl <[email protected]> | 2016-11-24 10:23:31 -0500 |
| commit | 1ec5994377b45b0299a9c4e6e7ab275792d81bc9 (patch) | |
| tree | 855977357c0ac152e2246b94ff27c31fbafe1df1 /mrbgems/mruby-proc-ext/test | |
| parent | a630c4f413f6af764e68210430e8b61a435d38d7 (diff) | |
| download | mruby-1ec5994377b45b0299a9c4e6e7ab275792d81bc9.tar.gz mruby-1ec5994377b45b0299a9c4e6e7ab275792d81bc9.zip | |
Fix calling .arity on Proc with undefined `initialize`
Reported by @bouk
Diffstat (limited to 'mrbgems/mruby-proc-ext/test')
| -rw-r--r-- | mrbgems/mruby-proc-ext/test/proc.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb index 75e11dd93..7a078aabf 100644 --- a/mrbgems/mruby-proc-ext/test/proc.rb +++ b/mrbgems/mruby-proc-ext/test/proc.rb @@ -58,6 +58,17 @@ assert('Proc#parameters') do assert_equal([[:req, :a], [:req, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:req, :f], [:req, :g], [:block, :h]], lambda {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters) end +assert('Proc#parameters with uninitialized Proc') do + begin + Proc.alias_method(:original_initialize, :initialize) + Proc.remove_method(:initialize) + assert_equal [], Proc.new{|a, b, c| 1}.parameters + ensure + Proc.alias_method(:initialize, :original_initialize) + Proc.remove_method(:original_initialize) + end +end + assert('Proc#to_proc') do proc = Proc.new {} assert_equal proc, proc.to_proc |
