[前][次][番号順一覧][スレッド一覧]

ruby-changes:45945

From: nobu <ko1@a...>
Date: Sun, 19 Mar 2017 00:30:19 +0900 (JST)
Subject: [ruby-changes:45945] nobu:r58016 (trunk): test_lambda.rb: refine test

nobu	2017-03-19 00:30:14 +0900 (Sun, 19 Mar 2017)

  New Revision: 58016

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58016

  Log:
    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]

  Modified files:
    trunk/test/ruby/test_lambda.rb
Index: test/ruby/test_lambda.rb
===================================================================
--- test/ruby/test_lambda.rb	(revision 58015)
+++ test/ruby/test_lambda.rb	(revision 58016)
@@ -31,8 +31,10 @@ class TestLambdaParameters < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_lambda.rb#L31
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]