summaryrefslogtreecommitdiff
path: root/tests/test_c_generator.py
diff options
context:
space:
mode:
authorJulian Hammer <julian.hammer@fau.de>2015-10-12 15:52:12 +0200
committerJulian Hammer <julian.hammer@fau.de>2015-10-20 13:01:13 +0200
commitdb9f2da09c9415e16cb76d18040ccb59579d6662 (patch)
tree13edc10a7879a9b8507080019f813b06f91847e6 /tests/test_c_generator.py
parentb846bb008c6fb89f544a76603fa74413fdbbe407 (diff)
downloadpycparser-db9f2da09c9415e16cb76d18040ccb59579d6662.tar.gz
Add support for #pragma
Preprocessor pragmas and their arguments are tokenized (as PPPRAGMA and PPPRAGMASTR) and included in the AST as a pppragma directive with the argument as value. If no argument was given the string will be empty. Unit test of the lexer, parser and generator have been modified and added accordingly. The previous behavior, that #pragma lines would be ignored, is henceforth obsolete.
Diffstat (limited to 'tests/test_c_generator.py')
-rw-r--r--tests/test_c_generator.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py
index dd6e5ed..edaced1 100644
--- a/tests/test_c_generator.py
+++ b/tests/test_c_generator.py
@@ -245,5 +245,14 @@ class TestCtoC(unittest.TestCase):
}
''')
+ def test_pragma(self):
+ self._assert_ctoc_correct(r'''
+ #pragma foo
+ void f() {
+ #pragma bar
+ i = (a, b, c);
+ }
+ ''')
+
if __name__ == "__main__":
unittest.main()