aboutsummaryrefslogtreecommitdiff
path: root/test/cases/underscore.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/cases/underscore.zig')
-rw-r--r--test/cases/underscore.zig28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/cases/underscore.zig b/test/cases/underscore.zig
new file mode 100644
index 0000000000..44451e3723
--- /dev/null
+++ b/test/cases/underscore.zig
@@ -0,0 +1,28 @@
+const std = @import("std");
+const assert = std.debug.assert;
+
+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;
+}