1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_regexp.rb: suppress warning

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-04-11 08:06:21 +00:00
parent c372b1236e
commit d9f6850ef3

View file

@ -111,8 +111,10 @@ class TestRegexp < Test::Unit::TestCase
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)