зеркало из https://github.com/mozilla/gecko-dev.git
Bug 774032 part 1 - Avoid Preprocessor.py replacing undefined variables with the attemptSubstitution filter. r=ted
This commit is contained in:
Родитель
c768a9468b
Коммит
94f8e1708f
|
@ -392,7 +392,7 @@ class Preprocessor:
|
|||
return str(self.context[varname])
|
||||
if fatal:
|
||||
raise Preprocessor.Error(self, 'UNDEFINED_VAR', varname)
|
||||
return ''
|
||||
return matchobj.group(0)
|
||||
return self.varsubst.sub(repl, aLine)
|
||||
def filter_attemptSubstitution(self, aLine):
|
||||
return self.filter_substitution(aLine, fatal=False)
|
||||
|
|
|
@ -172,11 +172,11 @@ BAR
|
|||
|
||||
def test_filter_attemptSubstitution(self):
|
||||
f = NamedIO('filter_attemptSubstitution.in', '''#filter attemptSubstitution
|
||||
P@VAR@ASS
|
||||
@PASS@
|
||||
#unfilter attemptSubstitution
|
||||
''')
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "PASS\n")
|
||||
self.assertEqual(self.pp.out.getvalue(), "@PASS@\n")
|
||||
|
||||
def test_filter_emptyLines(self):
|
||||
f = NamedIO('filter_emptyLines.in', '''lines with a
|
||||
|
|
|
@ -392,7 +392,7 @@ class Preprocessor:
|
|||
return str(self.context[varname])
|
||||
if fatal:
|
||||
raise Preprocessor.Error(self, 'UNDEFINED_VAR', varname)
|
||||
return ''
|
||||
return matchobj.group(0)
|
||||
return self.varsubst.sub(repl, aLine)
|
||||
def filter_attemptSubstitution(self, aLine):
|
||||
return self.filter_substitution(aLine, fatal=False)
|
||||
|
|
Загрузка…
Ссылка в новой задаче