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('#', /&(?.*?); (?y)/.match("aaa & yyy").inspect) - /(?[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)