zig/test/behavior/underscore.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

29 lines
566 B
Zig

const std = @import("std");
const expect = std.testing.expect;
test "ignore lval with underscore" {
_ = false;
}
test "ignore lval with underscore (for loop)" {
for ([_]void{}) |_, i| {
for ([_]void{}) |_, j| {
break;
}
break;
}
}
test "ignore lval with underscore (while loop)" {
while (optionalReturnError()) |_| {
while (optionalReturnError()) |_| {
break;
} else |_| {}
break;
} else |_| {}
}
fn optionalReturnError() !?u32 {
return error.optionalReturnError;
}