re.c: fix up r55036

* re.c (match_values_at): fix regression at r55036.
  MatchData#values_at accepts Range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-05-17 18:16:08 +00:00
parent 093c389390
commit 7f860741b9
3 changed files with 27 additions and 3 deletions

View file

@ -383,6 +383,7 @@ class TestRegexp < Test::Unit::TestCase
def test_match_values_at
m = /(...)(...)(...)(...)?/.match("foobarbaz")
assert_equal(["foo", "bar", "baz"], m.values_at(1, 2, 3))
assert_equal(["foo", "bar", "baz"], m.values_at(1..3))
m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
assert_equal(["1", "2", "+"], m.values_at(:a, 'b', :op))