aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/error.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig
index ee9e961884..c915da9a6e 100644
--- a/test/behavior/error.zig
+++ b/test/behavior/error.zig
@@ -1100,3 +1100,14 @@ test "return error union with i65" {
fn add(x: i65, y: i65) anyerror!i65 {
return x + y;
}
+
+test "compare error union to error set" {
+ const S = struct {
+ fn doTheTest(val: error{Foo}!i32) !void {
+ if (error.Foo == val) return error.Unexpected;
+ if (val == error.Foo) return error.Unexpected;
+ }
+ };
+ try S.doTheTest(0);
+ try comptime S.doTheTest(0);
+}