summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-16 19:34:52 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-16 19:34:52 +0000
commitf6e44a2a5a8d51b7991822118e3c7dc5d2e06146 (patch)
tree780a4db6a66286b4a0841d03bfca9b142f448112 /test
parentf327b5e23ce39b3dbe9ada818232731d7c70e39b (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_3@57349 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 47bd0d56af..bf7a2d0f9b 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1483,6 +1483,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!