mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 932552 - add tests for comments in manifest expressions. r=jhammel
This commit is contained in:
parent
50187f1b24
commit
b67f4748f5
@ -64,5 +64,18 @@ class ExpressionParserTest(unittest.TestCase):
|
||||
self.assertTrue(parse("true && (true || false)"))
|
||||
self.assertTrue(parse("(true && false) || (true && (true || false))"))
|
||||
|
||||
def test_comments(self):
|
||||
# comments in expressions work accidentally, via an implementation
|
||||
# detail - the '#' character doesn't match any of the regular
|
||||
# expressions we specify as tokens, and thus are ignored.
|
||||
# However, having explicit tests for them means that should the
|
||||
# implementation ever change, comments continue to work, even if that
|
||||
# means a new implementation must handle them explicitly.
|
||||
self.assertTrue(parse("true == true # it does!"))
|
||||
self.assertTrue(parse("false == false # it does"))
|
||||
self.assertTrue(parse("false != true # it doesnt"))
|
||||
self.assertTrue(parse('"string with #" == "string with #" # really, it does'))
|
||||
self.assertTrue(parse('"string with #" != "string with # but not the same" # no match!'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user