mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
4b9480677f
--HG-- rename : testing/mozbase/docs/manifestdestiny.rst => testing/mozbase/docs/manifestparser.rst rename : testing/mozbase/manifestdestiny/manifestparser/__init__.py => testing/mozbase/manifestparser/manifestparser/__init__.py rename : testing/mozbase/manifestdestiny/manifestparser/manifestparser.py => testing/mozbase/manifestparser/manifestparser/manifestparser.py rename : testing/mozbase/manifestdestiny/setup.py => testing/mozbase/manifestparser/setup.py rename : testing/mozbase/manifestdestiny/tests/comment-example.ini => testing/mozbase/manifestparser/tests/comment-example.ini rename : testing/mozbase/manifestdestiny/tests/default-skipif.ini => testing/mozbase/manifestparser/tests/default-skipif.ini rename : testing/mozbase/manifestdestiny/tests/filter-example.ini => testing/mozbase/manifestparser/tests/filter-example.ini rename : testing/mozbase/manifestdestiny/tests/fleem => testing/mozbase/manifestparser/tests/fleem rename : testing/mozbase/manifestdestiny/tests/include-example.ini => testing/mozbase/manifestparser/tests/include-example.ini rename : testing/mozbase/manifestdestiny/tests/include/bar.ini => testing/mozbase/manifestparser/tests/include/bar.ini rename : testing/mozbase/manifestdestiny/tests/include/crash-handling => testing/mozbase/manifestparser/tests/include/crash-handling rename : testing/mozbase/manifestdestiny/tests/include/flowers => testing/mozbase/manifestparser/tests/include/flowers rename : testing/mozbase/manifestdestiny/tests/include/foo.ini => testing/mozbase/manifestparser/tests/include/foo.ini rename : testing/mozbase/manifestdestiny/tests/just-defaults.ini => testing/mozbase/manifestparser/tests/just-defaults.ini rename : testing/mozbase/manifestdestiny/tests/manifest.ini => testing/mozbase/manifestparser/tests/manifest.ini rename : testing/mozbase/manifestdestiny/tests/mozmill-example.ini => testing/mozbase/manifestparser/tests/mozmill-example.ini rename : testing/mozbase/manifestdestiny/tests/mozmill-restart-example.ini => testing/mozbase/manifestparser/tests/mozmill-restart-example.ini rename : testing/mozbase/manifestdestiny/tests/no-tests.ini => testing/mozbase/manifestparser/tests/no-tests.ini rename : testing/mozbase/manifestdestiny/tests/path-example.ini => testing/mozbase/manifestparser/tests/path-example.ini rename : testing/mozbase/manifestdestiny/tests/relative-path.ini => testing/mozbase/manifestparser/tests/relative-path.ini rename : testing/mozbase/manifestdestiny/tests/test_convert_directory.py => testing/mozbase/manifestparser/tests/test_convert_directory.py rename : testing/mozbase/manifestdestiny/tests/test_convert_symlinks.py => testing/mozbase/manifestparser/tests/test_convert_symlinks.py rename : testing/mozbase/manifestdestiny/tests/test_default_skipif.py => testing/mozbase/manifestparser/tests/test_default_skipif.py rename : testing/mozbase/manifestdestiny/tests/test_expressionparser.py => testing/mozbase/manifestparser/tests/test_expressionparser.py rename : testing/mozbase/manifestdestiny/tests/test_manifestparser.py => testing/mozbase/manifestparser/tests/test_manifestparser.py rename : testing/mozbase/manifestdestiny/tests/test_read_ini.py => testing/mozbase/manifestparser/tests/test_read_ini.py rename : testing/mozbase/manifestdestiny/tests/test_testmanifest.py => testing/mozbase/manifestparser/tests/test_testmanifest.py rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/subdir/manifest.ini => testing/mozbase/manifestparser/tests/verifyDirectory/subdir/manifest.ini rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/subdir/test_sub.js => testing/mozbase/manifestparser/tests/verifyDirectory/subdir/test_sub.js rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/test_1.js => testing/mozbase/manifestparser/tests/verifyDirectory/test_1.js rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/test_2.js => testing/mozbase/manifestparser/tests/verifyDirectory/test_2.js rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/test_3.js => testing/mozbase/manifestparser/tests/verifyDirectory/test_3.js rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/verifyDirectory.ini => testing/mozbase/manifestparser/tests/verifyDirectory/verifyDirectory.ini rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/verifyDirectory_incomplete.ini => testing/mozbase/manifestparser/tests/verifyDirectory/verifyDirectory_incomplete.ini rename : testing/mozbase/manifestdestiny/tests/verifyDirectory/verifyDirectory_toocomplete.ini => testing/mozbase/manifestparser/tests/verifyDirectory/verifyDirectory_toocomplete.ini
70 lines
2.3 KiB
Python
Executable File
70 lines
2.3 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
"""
|
|
test .ini parsing
|
|
|
|
ensure our .ini parser is doing what we want; to be deprecated for
|
|
python's standard ConfigParser when 2.7 is reality so OrderedDict
|
|
is the default:
|
|
|
|
http://docs.python.org/2/library/configparser.html
|
|
"""
|
|
|
|
import unittest
|
|
from manifestparser import read_ini
|
|
from ConfigParser import ConfigParser
|
|
from StringIO import StringIO
|
|
|
|
class IniParserTest(unittest.TestCase):
|
|
|
|
def test_inline_comments(self):
|
|
"""
|
|
We have no inline comments; so we're testing to ensure we don't:
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=855288
|
|
"""
|
|
|
|
# test '#' inline comments (really, the lack thereof)
|
|
string = """[test_felinicity.py]
|
|
kittens = true # This test requires kittens
|
|
"""
|
|
buffer = StringIO()
|
|
buffer.write(string)
|
|
buffer.seek(0)
|
|
result = read_ini(buffer)[0][1]['kittens']
|
|
self.assertEqual(result, "true # This test requires kittens")
|
|
|
|
# compare this to ConfigParser
|
|
# python 2.7 ConfigParser does not support '#' as an
|
|
# inline comment delimeter (for "backwards compatability"):
|
|
# http://docs.python.org/2/library/configparser.html
|
|
buffer.seek(0)
|
|
parser = ConfigParser()
|
|
parser.readfp(buffer)
|
|
control = parser.get('test_felinicity.py', 'kittens')
|
|
self.assertEqual(result, control)
|
|
|
|
# test ';' inline comments (really, the lack thereof)
|
|
string = string.replace('#', ';')
|
|
buffer = StringIO()
|
|
buffer.write(string)
|
|
buffer.seek(0)
|
|
result = read_ini(buffer)[0][1]['kittens']
|
|
self.assertEqual(result, "true ; This test requires kittens")
|
|
|
|
# compare this to ConfigParser
|
|
# python 2.7 ConfigParser *does* support ';' as an
|
|
# inline comment delimeter (ibid).
|
|
# Python 3.x configparser, OTOH, does not support
|
|
# inline-comments by default. It does support their specification,
|
|
# though they are weakly discouraged:
|
|
# http://docs.python.org/dev/library/configparser.html
|
|
buffer.seek(0)
|
|
parser = ConfigParser()
|
|
parser.readfp(buffer)
|
|
control = parser.get('test_felinicity.py', 'kittens')
|
|
self.assertNotEqual(result, control)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|