1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* re.c (rb_reg_regsub): don't repeat repl twice with

"X".sub!(/./, sprintf("\\%c", 255)).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-02-17 15:35:09 +00:00
parent adc639bb26
commit 583a4b1774
3 changed files with 7 additions and 1 deletions

View file

@ -407,7 +407,7 @@ class TestRegexp < Test::Unit::TestCase
assert_equal("fooXXXbaz", "foobarbaz".sub!(/bar/, "XXX"))
s = [0xff].pack("C")
assert_equal(s, "X".sub!(/./, s))
assert_equal('\\' + s + '\\' + s, "X".sub!(/./, '\\' + s)) # ???
assert_equal('\\' + s, "X".sub!(/./, '\\' + s))
assert_equal('\k', "foo".sub!(/.../, '\k'))
assert_raise(RuntimeError) { "foo".sub!(/(?<x>o)/, '\k<x') }
assert_equal('foo[bar]baz', "foobarbaz".sub!(/(b..)/, '[\0]'))