mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
stage2: add a test for for loops in LLVM backend
This commit is contained in:
parent
d4ec0279d3
commit
ed6757ece6
@ -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;
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user