Added test case for expressions
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py
index bae764c..b489bb8 100644
--- a/tests/test_c_parser.py
+++ b/tests/test_c_parser.py
@@ -261,12 +261,12 @@
['TypeDecl', ['IdentifierType', ['int']]]]])
# function return values and parameters may not have type information
- self.assertEqual(self.get_decl('extern foobar(foo, bar);'),
- ['Decl', 'foobar',
- ['FuncDecl',
+ self.assertEqual(self.get_decl('extern foobar(foo, bar);'),
+ ['Decl', 'foobar',
+ ['FuncDecl',
[ ['ID', 'foo'],
['ID', 'bar']
- ],
+ ],
['TypeDecl', ['IdentifierType', ['int']]]]])
def test_nested_decls(self): # the fun begins
@@ -1225,6 +1225,19 @@
e2 = r'''char n = '\n', *prefix = "st_";'''
self.assert_all_Constants(e2, [r"'\n'", '"st_"'])
+ s1 = r'''int main() {
+ int i = 5, j = 6, k = 1;
+ if ((i=j && k == 1) || k > j)
+ printf("Hello, world\n");
+ return 0;
+ }'''
+ ps1 = self.parse(s1)
+ self.assert_all_Constants(ps1,
+ ['5', '6', '1', '1', '"Hello, world\\n"', '0'])
+ self.assert_num_ID_refs(ps1, 'i', 1)
+ self.assert_num_ID_refs(ps1, 'j', 2)
+
+
def test_statements(self):
s1 = r'''
void foo(){