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:
parent
adc639bb26
commit
583a4b1774
3 changed files with 7 additions and 1 deletions
|
@ -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]'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue