Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/test_c_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,25 @@ def assert_default_node(node):

self.assertEqual(switch.stmt.block_items, [])

s4 = r'''
int foo(void) {
int x = 0;
switch (x) {
default:
}
return 0;
}
'''
ps4 = self.parse(s4)
switch4 = ps4.ext[0].body.block_items[1]

block4 = switch4.stmt.block_items
self.assertEqual(len(block4), 1)
assert_default_node(block4[0])
# An empty default label should still contain a single EmptyStatement
self.assertEqual(len(block4[0].stmts), 1)
self.assertIsInstance(block4[0].stmts[0], EmptyStatement)

def test_for_statement(self):
s2 = r'''
void x(void)
Expand Down