mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Fixed bug in perlReToReplacer where escaped slashes would stay in the output.
This commit is contained in:
parent
367569f1c7
commit
a0fe5410c0
@ -219,6 +219,7 @@ def perlReToReplacer(s):
|
|||||||
replacement.
|
replacement.
|
||||||
"""
|
"""
|
||||||
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
||||||
|
replace = replace.replace('\\/', '/')
|
||||||
if kind != 's':
|
if kind != 's':
|
||||||
raise ValueError, 'Invalid kind: must be "s"'
|
raise ValueError, 'Invalid kind: must be "s"'
|
||||||
g = False
|
g = False
|
||||||
|
@ -134,6 +134,8 @@ class UtilsTest(unittest.TestCase):
|
|||||||
self.assertEqual(f('fooba/rba/z'), 'foorz')
|
self.assertEqual(f('fooba/rba/z'), 'foorz')
|
||||||
f = utils.perlReToReplacer('s/cat/dog/i')
|
f = utils.perlReToReplacer('s/cat/dog/i')
|
||||||
self.assertEqual(f('CATFISH'), 'dogFISH')
|
self.assertEqual(f('CATFISH'), 'dogFISH')
|
||||||
|
f = utils.perlReToReplacer('s/foo/foo\/bar/')
|
||||||
|
self.assertEqual(f('foo'), 'foo/bar')
|
||||||
|
|
||||||
def testFindBinaryInPath(self):
|
def testFindBinaryInPath(self):
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
|
Loading…
Reference in New Issue
Block a user