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

ruby-changes:42463

From: nobu <ko1@a...>
Date: Mon, 11 Apr 2016 16:09:44 +0900 (JST)
Subject: [ruby-changes:42463] nobu:r54537 (trunk): test_regexp.rb: suppress warning

nobu	2016-04-11 17:06:21 +0900 (Mon, 11 Apr 2016)

  New Revision: 54537

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

  Log:
    test_regexp.rb: suppress warning
    
    * test/ruby/test_regexp.rb (test_named_capture): suppress
      "assigned but unused variable" warning by prefixing '_'.

  Modified files:
    trunk/test/ruby/test_regexp.rb
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 54536)
+++ test/ruby/test_regexp.rb	(revision 54537)
@@ -111,8 +111,10 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L111
     assert_equal('#<MatchData "&amp; y" foo:"amp" foo:"y">',
       /&(?<foo>.*?); (?<foo>y)/.match("aaa &amp; yyy").inspect)
 
-    /(?<id>[A-Za-z_]+)/ =~ "!abc"
-    assert_equal("abc", Regexp.last_match(:id))
+    /(?<_id>[A-Za-z_]+)/ =~ "!abc"
+    assert_not_nil(Regexp.last_match)
+    assert_equal("abc", Regexp.last_match(1))
+    assert_equal("abc", Regexp.last_match(:_id))
 
     /a/ =~ "b" # doesn't match.
     assert_equal(nil, Regexp.last_match)

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

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