michael@0: #!/usr/bin/env python michael@0: michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: import os michael@0: import unittest michael@0: from manifestparser import ManifestParser michael@0: michael@0: here = os.path.dirname(os.path.abspath(__file__)) michael@0: michael@0: class TestDefaultSkipif(unittest.TestCase): michael@0: """test applying a skip-if condition in [DEFAULT] and || with the value for the test""" michael@0: michael@0: michael@0: def test_defaults(self): michael@0: michael@0: default = os.path.join(here, 'default-skipif.ini') michael@0: parser = ManifestParser(manifests=(default,)) michael@0: for test in parser.tests: michael@0: if test['name'] == 'test1': michael@0: self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug)") michael@0: elif test['name'] == 'test2': michael@0: self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'linux')") michael@0: elif test['name'] == 'test3': michael@0: self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win')") michael@0: elif test['name'] == 'test4': michael@0: self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win' && debug)") michael@0: elif test['name'] == 'test5': michael@0: self.assertEqual(test['skip-if'], "os == 'win' && debug # a pesky comment") michael@0: elif test['name'] == 'test6': michael@0: self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug )") michael@0: michael@0: if __name__ == '__main__': michael@0: unittest.main()