summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 10:55:32 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 10:55:32 +0000
commitea83d7fd0637dd82125ed6ac7cce23c9a0c5653f (patch)
tree025265b8a6b16b0ac02c43b29b74da98c01e8f2b /test
parent745565052a915f8815cd5d3cf299ab4cba20c57c (diff)
merge revision(s) 57098: [Backport #13042]
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/branches/ruby_2_2@57218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 4cd6afdd80..3375a8a3a3 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1507,6 +1507,10 @@ class TestString < Test::Unit::TestCase
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!