| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
test_cmt_parser.py
Go to the documentation of this file.
1 from cmt2cmake import makeParser
2 from pyparsing import ParseException
3
4 CMTParser = makeParser(set(["QMTest", "install_python_modules", "install_scripts",
5 "install_more_includes", "god_headers", "god_dictionary",
6 "PyQtResource", "PyQtUIC"])
7 | set(['reflex_dictionary', 'component_library', 'linker_library',
8 'copy_relax_rootmap']))
9 def _test_package():
10 tokens = list(CMTParser.parseString('package Test'))
11 assert tokens == ['package', 'Test']
12
13 def test_version():
14 tokens = list(CMTParser.parseString('version v1r2p3'))
15 assert tokens == ['version', 'v1r2p3']
16
17 def test_library():
18 statement = 'library GaudiKernelLib *.cpp -no_static -import=Boost'
19 tokens = list(CMTParser.parseString(statement))
20 print tokens
21 assert tokens == ['library', 'GaudiKernelLib', '*.cpp', '-no_static', '-import=Boost']
22
23 statement = 'library TestLib test/lib/*.cpp a_variable=some_value -group=tests'
24 tokens = list(CMTParser.parseString(statement))
25 print tokens
26 assert tokens == ['library', 'TestLib', 'test/lib/*.cpp', 'a_variable=some_value', '-group=tests']
27
28 def test_macro():
29 s = 'macro_append ROOT_linkopts "some" WIN32 "other"'
30 tokens = list(CMTParser.parseString(s))
31 print tokens
32 assert tokens == ['macro_append', 'ROOT_linkopts', '"some"', 'WIN32', '"other"']
33
34 s = 'macro a_var "value"'
35 tokens = list(CMTParser.parseString(s))
36 print tokens
37 assert tokens == ['macro', 'a_var', '"value"']
38
39 s = 'macro a_var'
40 try:
41 tokens = list(CMTParser.parseString(s))
42 assert False, 'parsing should have failed: %r' % s
43 except ParseException:
44 pass
45
46 def test_apply_pattern():
47 s = 'apply_pattern component_library library=L0DU'
48 tokens = list(CMTParser.parseString(s))
49 print tokens
50 assert tokens == ['apply_pattern', 'component_library', 'library=L0DU']
51
52 def test_implicit_apply_pattern():
53 s = 'component_library library=L0DU'
54 tokens = list(CMTParser.parseString(s))
55 print tokens
56 assert tokens == ['apply_pattern', 'component_library', 'library=L0DU']