Issue #84: fix C generation for some statements
diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py
index 3fc0d0e..5392603 100644
--- a/tests/test_c_generator.py
+++ b/tests/test_c_generator.py
@@ -130,7 +130,14 @@
return 0;
}''')
-
+ def test_issue84(self):
+ self._assert_ctoc_correct(r'''
+ void x(void) {
+ for (int i = 0;;)
+ i;
+ }
+ ''')
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py
index 8ef01cd..946cee5 100644
--- a/tests/test_c_parser.py
+++ b/tests/test_c_parser.py
@@ -1390,7 +1390,7 @@
# a ref in the visitor
#
self.assert_num_ID_refs(ps2, 'i', 3)
-
+
s3 = r'''
void x(void)
{
@@ -1406,6 +1406,15 @@
#
self.assert_num_ID_refs(ps3, 'i', 2)
+ s4 = r'''
+ void x(void) {
+ for (int i = 0;;)
+ i;
+ }
+ '''
+ ps4 = self.parse(s4)
+ self.assert_num_ID_refs(ps4, 'i', 1)
+
def _open_c_file(self, name):
""" Find a c file by name, taking into account the current dir can be
in a couple of typical places