summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-18 15:30:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-18 15:30:14 +0000
commit1de013b3da729d1616dc0ec9bc3796e5cd3f1a6d (patch)
treeb757a2170c076e4f3565c12ef317583969e9d23a
parent49455d6cdcc6430368e1722806f2c3af9cc6eba2 (diff)
downloadruby-1de013b3da729d1616dc0ec9bc3796e5cd3f1a6d.tar.gz
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
-rw-r--r--test/ruby/test_lambda.rb6
1 files 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