diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-09-09 18:51:13 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2019-09-09 18:51:13 +0200 |
| commit | cc6376058784aa7a910e93c31ac8bd819de4e187 (patch) | |
| tree | 0aa35cb3c24648b2944f548a2101e20999048d92 /test | |
| parent | 2482bdf22b77bdee718167da5390157cc792dced (diff) | |
| download | zig-cc6376058784aa7a910e93c31ac8bd819de4e187.tar.gz zig-cc6376058784aa7a910e93c31ac8bd819de4e187.zip | |
Allow comparison between union tag and enum literal
Closes #2810
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/union.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/stage1/behavior/union.zig b/test/stage1/behavior/union.zig index d28a0f8ea4..1f8ca82958 100644 --- a/test/stage1/behavior/union.zig +++ b/test/stage1/behavior/union.zig @@ -467,3 +467,13 @@ test "union no tag with struct member" { var u = Union{ .s = Struct{} }; u.foo(); } + +test "comparison between union and enum literal" { + var x = Payload{.A = 42}; + expect(x == .A); + expect(x != .B); + expect(x != .C); + expect((x == .B) == false); + expect((x == .C) == false); + expect((x != .A) == false); +} |
