From ea83d7fd0637dd82125ed6ac7cce23c9a0c5653f Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 27 Dec 2016 10:55:32 +0000 Subject: 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 --- test/ruby/test_string.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') 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') + } end def test_sub! -- cgit v1.2.3