stage2: add a test for for loops in LLVM backend

This commit is contained in:
Timon Kruiper 2021-01-19 10:27:16 +01:00 committed by Andrew Kelley
parent d4ec0279d3
commit ed6757ece6

View File

@ -172,4 +172,23 @@ pub fn addCases(ctx: *TestContext) !void {
\\}
, "");
}
{
var case = ctx.exeUsingLlvmBackend("for loop", linux_x64);
case.addCompareOutput(
\\fn assert(ok: bool) void {
\\ if (!ok) unreachable;
\\}
\\
\\export fn main() c_int {
\\ var x: u32 = 0;
\\ for ("hello") |_| {
\\ x += 1;
\\ }
\\ assert("hello".len == x);
\\ return 0;
\\}
, "");
}
}