diff options
author | Jeremy Evans <code@jeremyevans.net> | 2020-06-10 15:17:54 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2020-06-10 17:49:54 -0700 |
commit | f3e927b0cc1fcbf03abea7f66b1a3736a270a8de (patch) | |
tree | dbe7b9d1db555e85171d7cb1eb72a0ca9c3509a9 /test/ruby/test_proc.rb | |
parent | f48fce4981574f7df33982eb901c94e8f4d6d4ab (diff) |
Make proc/Proc.new without block an error instead of warning
The warning for these was added in 2.7.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3208
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r-- | test/ruby/test_proc.rb | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 14b79380e2..765b400dbe 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -53,11 +53,9 @@ class TestProc < Test::Unit::TestCase assert_equal(5, x) end - def assert_arity(n) + def assert_arity(n, &block) meta = class << self; self; end - b = assert_warn(/Capturing the given block using Proc\.new is deprecated/) do - Proc.new - end + b = Proc.new(&block) meta.class_eval { remove_method(:foo_arity) if method_defined?(:foo_arity) define_method(:foo_arity, b) @@ -1433,16 +1431,6 @@ class TestProc < Test::Unit::TestCase end; end - def method_for_test_proc_without_block_for_symbol - assert_warn(/Capturing the given block using Kernel#proc is deprecated/) do - binding.eval('proc') - end - end - - def test_proc_without_block_for_symbol - assert_equal('1', method_for_test_proc_without_block_for_symbol(&:to_s).call(1), '[Bug #14782]') - end - def test_compose f = proc {|x| x * 2} g = proc {|x| x + 1} |