summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorldore <laurent.dore@gmail.com>2022-11-10 14:30:04 +0100
committerGitHub <noreply@github.com>2022-11-10 05:30:04 -0800
commitf5ca0284e2c1c9ac2a5be45735735f2f287073cc (patch)
tree5dc4a50b7b426b720109542545290fec113934c3 /tests
parentb13a06d22d05d47f115f3ed141f4fa727c654c6d (diff)
downloadpycparser-f5ca0284e2c1c9ac2a5be45735735f2f287073cc.tar.gz
Fix #479 (multi-pragma/single statement blocks) (#480)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_c_generator.py9
-rwxr-xr-xtests/test_c_parser.py4
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py
index d166d03..c9d5961 100644
--- a/tests/test_c_generator.py
+++ b/tests/test_c_generator.py
@@ -339,10 +339,17 @@ class TestCtoC(unittest.TestCase):
void f() {
#pragma bar
i = (a, b, c);
+ if (d)
+ #pragma qux
+ j = e;
+ if (d)
+ #pragma qux
+ #pragma quux
+ j = e;
}
typedef struct s {
#pragma baz
- } s;
+ } s;
''')
def test_compound_literal(self):
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py
index 4a5c90b..9b53622 100755
--- a/tests/test_c_parser.py
+++ b/tests/test_c_parser.py
@@ -1776,6 +1776,7 @@ class TestCParser_fundamentals(TestCParser_base):
if (sum > 10)
#pragma bar
+ #pragma baz
sum = 10;
switch (sum)
@@ -1800,7 +1801,8 @@ class TestCParser_fundamentals(TestCParser_base):
self.assertIsInstance(s1_ast.ext[0].body.block_items[4], If)
self.assertIsInstance(s1_ast.ext[0].body.block_items[4].iftrue, Compound)
self.assertIsInstance(s1_ast.ext[0].body.block_items[4].iftrue.block_items[0], Pragma)
- self.assertIsInstance(s1_ast.ext[0].body.block_items[4].iftrue.block_items[1], Assignment)
+ self.assertIsInstance(s1_ast.ext[0].body.block_items[4].iftrue.block_items[1], Pragma)
+ self.assertIsInstance(s1_ast.ext[0].body.block_items[4].iftrue.block_items[2], Assignment)
self.assertIsInstance(s1_ast.ext[0].body.block_items[5], Switch)
self.assertIsInstance(s1_ast.ext[0].body.block_items[5].stmt.stmts[0], Compound)
self.assertIsInstance(s1_ast.ext[0].body.block_items[5].stmt.stmts[0].block_items[0],