From 1de013b3da729d1616dc0ec9bc3796e5cd3f1a6d Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 18 Mar 2017 15:30:14 +0000 Subject: test_lambda.rb: refine test * test/ruby/test_lambda.rb (test_lambda_as_iterator): refine a test for the intention of the original report. [ruby-core:61340] [Bug #9605] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_lambda.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index c47351886a..ac8f639643 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -31,8 +31,10 @@ class TestLambdaParameters < Test::Unit::TestCase bug9605 = '[ruby-core:61468] [Bug #9605]' assert_nothing_raised(ArgumentError, bug9605) {1.times(&->(n){ a += 1 })} assert_equal(3, a, bug9605) - assert_nothing_raised(ArgumentError, bug9605) {a = [[1, 2]].map(&->(x, y) {x+y})} - assert_equal([3], a, bug9605) + assert_nothing_raised(ArgumentError, bug9605) { + a = %w(Hi there how are you).each_with_index.detect(&->(w, i) {w.length == 3}) + } + assert_equal(["how", 2], a, bug9605) end def test_call_rest_args -- cgit v1.2.3