Bug 774032 part 1 - Avoid Preprocessor.py replacing undefined variables with the attemptSubstitution filter. r=ted

This commit is contained in:
Mike Hommey 2012-08-04 08:47:28 +02:00
Родитель c768a9468b
Коммит 94f8e1708f
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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)