diff options
Diffstat (limited to 'test/behavior/underscore.zig')
| -rw-r--r-- | test/behavior/underscore.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/behavior/underscore.zig b/test/behavior/underscore.zig new file mode 100644 index 0000000000..516d33a4eb --- /dev/null +++ b/test/behavior/underscore.zig @@ -0,0 +1,28 @@ +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; +} |
