From bf34ade7ef32f89aa5ba238d0a780f23eacb0487 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 12 Nov 2019 22:58:09 +0900 Subject: Show the name `Kernel#proc` in the warning message --- test/ruby/test_proc.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') 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 -- cgit v1.2.3