re.c: non-regexp name reference

* re.c (rb_reg_regsub): other than regexp has no name references.
  [ruby-core:78686] [Bug #13042]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-12-17 00:52:47 +00:00
parent d4ff516f33
commit 7f4dc81717
2 changed files with 6 additions and 1 deletions

View file

@ -1598,6 +1598,10 @@ CODE
assert_equal(S("Abc"), S("abc").sub("a") {m = $~; "A"})
assert_equal(S("a"), m[0])
assert_equal(/a/, m.regexp)
bug = '[ruby-core:78686] [Bug #13042] other than regexp has no name references'
assert_raise_with_message(IndexError, /oops/, bug) {
'hello'.gsub('hello', '\k<oops>')
}
end
def test_sub!