translate-c supports for loops

This commit is contained in:
Andrew Kelley
2017-11-25 00:57:48 -05:00
parent 18eb3c5f90
commit bf20b260ce
2 changed files with 60 additions and 6 deletions

View File

@@ -949,6 +949,19 @@ pub fn addCases(cases: &tests.TranslateCContext) {
\\ return;
\\}
);
cases.add("for loop",
\\void foo(void) {
\\ for (int i = 0; i < 10; i += 1) { }
\\}
,
\\pub fn foo() {
\\ {
\\ var i: c_int = 0;
\\ while (i < 10) : (i += 1) {};
\\ };
\\}
);
}