diff options
| author | Jacob G-W <jacoblevgw@gmail.com> | 2021-06-19 21:10:22 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-06-21 17:03:03 -0700 |
| commit | 9fffffb07b081858db0c2102a0680aa166b48263 (patch) | |
| tree | 36caed31c5b2aaa8e08bb8e6e90e9b2c30910ff3 /test/behavior/switch.zig | |
| parent | b83b3883ba0b5e965f8f7f1298c77c6d766741af (diff) | |
| download | zig-9fffffb07b081858db0c2102a0680aa166b48263.tar.gz zig-9fffffb07b081858db0c2102a0680aa166b48263.zip | |
fix code broken from previous commit
Diffstat (limited to 'test/behavior/switch.zig')
| -rw-r--r-- | test/behavior/switch.zig | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig index ad32d2edaf..e512565b80 100644 --- a/test/behavior/switch.zig +++ b/test/behavior/switch.zig @@ -386,6 +386,7 @@ test "switch with null and T peer types and inferred result location type" { 0 => true, else => null, }) |v| { + _ = v; @panic("fail"); } } @@ -411,12 +412,18 @@ test "switch prongs with cases with identical payload types" { try expect(@TypeOf(e) == usize); try expect(e == 8); }, - .B => |e| @panic("fail"), + .B => |e| { + _ = e; + @panic("fail"); + }, } } fn doTheSwitch2(u: Union) !void { switch (u) { - .A, .C => |e| @panic("fail"), + .A, .C => |e| { + _ = e; + @panic("fail"); + }, .B => |e| { try expect(@TypeOf(e) == isize); try expect(e == -8); @@ -508,7 +515,10 @@ test "switch on error set with single else" { fn doTheTest() !void { var some: error{Foo} = error.Foo; try expect(switch (some) { - else => |a| true, + else => |a| blk: { + a catch {}; + break :blk true; + }, }); } }; |
