Fixed bug in perlReToReplacer where escaped slashes would stay in the output.

This commit is contained in:
Jeremy Fincher 2003-10-12 13:11:53 +00:00
parent 367569f1c7
commit a0fe5410c0
2 changed files with 3 additions and 0 deletions

View File

@ -219,6 +219,7 @@ def perlReToReplacer(s):
replacement.
"""
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
replace = replace.replace('\\/', '/')
if kind != 's':
raise ValueError, 'Invalid kind: must be "s"'
g = False

View File

@ -134,6 +134,8 @@ class UtilsTest(unittest.TestCase):
self.assertEqual(f('fooba/rba/z'), 'foorz')
f = utils.perlReToReplacer('s/cat/dog/i')
self.assertEqual(f('CATFISH'), 'dogFISH')
f = utils.perlReToReplacer('s/foo/foo\/bar/')
self.assertEqual(f('foo'), 'foo/bar')
def testFindBinaryInPath(self):
if os.name == 'posix':