зеркало из https://github.com/mozilla/gecko-dev.git
Bug 974368 - Fix ! operator precedence in manifestparser's expression parser. r=jmaher
This commit is contained in:
Родитель
20b2f06ee8
Коммит
ee87a8a0da
|
@ -8,7 +8,7 @@ support-files =
|
|||
[browser_bug731866.js]
|
||||
[browser_connection.js]
|
||||
[browser_healthreport.js]
|
||||
skip-if = (!healthreport) || (os == 'linux' && debug)
|
||||
skip-if = !healthreport || (os == 'linux' && debug)
|
||||
[browser_privacypane_1.js]
|
||||
[browser_privacypane_3.js]
|
||||
[browser_privacypane_5.js]
|
||||
|
|
|
@ -8,7 +8,7 @@ support-files =
|
|||
[browser_bug705422.js]
|
||||
[browser_chunk_permissions.js]
|
||||
[browser_healthreport.js]
|
||||
skip-if = (!healthreport) || (os == 'linux' && debug)
|
||||
skip-if = !healthreport || (os == 'linux' && debug)
|
||||
[browser_permissions.js]
|
||||
[browser_privacypane_1.js]
|
||||
[browser_privacypane_3.js]
|
||||
|
|
|
@ -85,7 +85,7 @@ class neq_op_token(object):
|
|||
class not_op_token(object):
|
||||
"!"
|
||||
def nud(self, parser):
|
||||
return not parser.expression()
|
||||
return not parser.expression(100)
|
||||
|
||||
class and_op_token(object):
|
||||
"&&"
|
||||
|
|
|
@ -78,5 +78,18 @@ class ExpressionParserTest(unittest.TestCase):
|
|||
self.assertTrue(parse('"string with #" == "string with #" # really, it does'))
|
||||
self.assertTrue(parse('"string with #" != "string with # but not the same" # no match!'))
|
||||
|
||||
def test_not(self):
|
||||
"""
|
||||
Test the ! operator.
|
||||
"""
|
||||
self.assertTrue(parse("!false"))
|
||||
self.assertTrue(parse("!(false)"))
|
||||
self.assertFalse(parse("!true"))
|
||||
self.assertFalse(parse("!(true)"))
|
||||
self.assertTrue(parse("!true || true)"))
|
||||
self.assertTrue(parse("true || !true)"))
|
||||
self.assertFalse(parse("!true && true"))
|
||||
self.assertFalse(parse("true && !true"))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Загрузка…
Ссылка в новой задаче