diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-11 08:06:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-11 08:06:21 +0000 |
commit | 84f5d06fdf12012a4fce801bf3577c0295e39b8d (patch) | |
tree | 8b13d281c1533f7d822c56e0e249c6056fcdd3ca /test | |
parent | 8464fb222e57be647d90388d29262be39ba13693 (diff) | |
download | ruby-84f5d06fdf12012a4fce801bf3577c0295e39b8d.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_regexp.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index fdb27a6c61..24ececcbf4 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -111,8 +111,10 @@ class TestRegexp < Test::Unit::TestCase assert_equal('#<MatchData "& y" foo:"amp" foo:"y">', /&(?<foo>.*?); (?<foo>y)/.match("aaa & 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) |