diff options
author | Jeremy Evans <[email protected]> | 2020-06-10 17:50:35 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2020-06-11 07:30:48 -0700 |
commit | 2188d6d160d3ba82432c87277310a4d417e136d5 (patch) | |
tree | f885cb534dc38c06db3431076719436563f96fb9 /test/ruby/test_lambda.rb | |
parent | 5349506eb4c0668fa1d6f512e4dae1021a9a7460 (diff) |
Warn when passing a non-literal block to Kernel#lambda
Implements [Feature #15973]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3209
Diffstat (limited to 'test/ruby/test_lambda.rb')
-rw-r--r-- | test/ruby/test_lambda.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index 03b501a6c9..75362e2796 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -74,6 +74,12 @@ class TestLambdaParameters < Test::Unit::TestCase assert_raise(ArgumentError, bug9605) {proc(&plus).call [1,2]} end + def test_warning_for_non_literal_blocks + assert_warn(/lambda without a literal block/, '[ruby-core:93482] [Feature #15973]') do + lambda(&:symbol) + end + end + def pass_along(&block) lambda(&block) end |