aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/switch.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/switch.zig')
-rw-r--r--test/behavior/switch.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig
index 16bb890c9e..caec804ec2 100644
--- a/test/behavior/switch.zig
+++ b/test/behavior/switch.zig
@@ -313,3 +313,16 @@ fn returnsFalse() bool {
test "switch on const enum with var" {
try expect(!returnsFalse());
}
+
+test "anon enum literal used in switch on union enum" {
+ const Foo = union(enum) {
+ a: i32,
+ };
+
+ var foo = Foo{ .a = 1234 };
+ switch (foo) {
+ .a => |x| {
+ try expect(x == 1234);
+ },
+ }
+}