summaryrefslogtreecommitdiff
path: root/test/ruby/test_proc.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-12 22:58:09 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-12 22:58:09 +0900
commitbf34ade7ef32f89aa5ba238d0a780f23eacb0487 (patch)
tree61e46055bcdf9b80c4ba971a0b03c2d71f3d965c /test/ruby/test_proc.rb
parent3816622fbedd034d338fcb1bbdc80d163e302ae6 (diff)
Show the name `Kernel#proc` in the warning message
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r--test/ruby/test_proc.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 467bbf5925..f09e58e926 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -55,7 +55,10 @@ class TestProc < Test::Unit::TestCase
def assert_arity(n)
meta = class << self; self; end
- meta.class_eval {define_method(:foo, Proc.new)}
+ b = assert_warn(/Capturing the given block using Proc\.new is deprecated/) do
+ Proc.new
+ end
+ meta.class_eval {define_method(:foo, b)}
assert_equal(n, method(:foo).arity)
end
@@ -1413,7 +1416,9 @@ class TestProc < Test::Unit::TestCase
end
def method_for_test_proc_without_block_for_symbol
- binding.eval('proc')
+ assert_warn(/Capturing the given block using Kernel#proc is deprecated/) do
+ binding.eval('proc')
+ end
end
def test_proc_without_block_for_symbol