summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-11-25 09:20:47 +0900
committerGitHub <[email protected]>2016-11-25 09:20:47 +0900
commitd77b25410880f0c79bd215c406ec44a9dac07769 (patch)
tree5519faefa52478adce9d4b9ae5db892aa9c95912 /test
parent6905597f5b750e75e3320a5c9a74e4c270f155eb (diff)
parent1ec5994377b45b0299a9c4e6e7ab275792d81bc9 (diff)
downloadmruby-d77b25410880f0c79bd215c406ec44a9dac07769.tar.gz
mruby-d77b25410880f0c79bd215c406ec44a9dac07769.zip
Merge pull request #3287 from bouk/proc-arity
Fix calling .arity on Proc with undefined `initialize`
Diffstat (limited to 'test')
-rw-r--r--test/t/proc.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/t/proc.rb b/test/t/proc.rb
index 888b7d56a..bc9821f7c 100644
--- a/test/t/proc.rb
+++ b/test/t/proc.rb
@@ -46,6 +46,17 @@ assert('Proc#arity', '15.2.17.4.2') do
assert_equal(-1, g)
end
+assert('Proc#arity with unitialized Proc') do
+ begin
+ Proc.alias_method(:original_initialize, :initialize)
+ Proc.remove_method(:initialize)
+ assert_equal 0, Proc.new{|a, b, c| 1}.arity
+ ensure
+ Proc.alias_method(:initialize, :original_initialize)
+ Proc.remove_method(:original_initialize)
+ end
+end
+
assert('Proc#call', '15.2.17.4.3') do
a = 0
b = Proc.new { a += 1 }