diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-24 00:44:18 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-24 00:44:18 -0400 |
| commit | d0551db5cd29e4c7f361ef40a37486138a4e8b1e (patch) | |
| tree | 9b591aa521477ec0bb3bd0ef046e50d140e51d67 /test | |
| parent | 64dddd7afe14a683826b03bc36ab80fa93a84e2c (diff) | |
| download | zig-d0551db5cd29e4c7f361ef40a37486138a4e8b1e.tar.gz zig-d0551db5cd29e4c7f361ef40a37486138a4e8b1e.zip | |
introduce the enum literal type
see #683
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/enum.zig | 9 | ||||
| -rw-r--r-- | test/stage1/behavior/type_info.zig | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/test/stage1/behavior/enum.zig b/test/stage1/behavior/enum.zig index 899aeea67d..fb6fa63593 100644 --- a/test/stage1/behavior/enum.zig +++ b/test/stage1/behavior/enum.zig @@ -892,3 +892,12 @@ test "tag name with assigned enum values" { var b = LocalFoo.B; expect(mem.eql(u8, @tagName(b), "B")); } + +test "enum literal equality" { + const x = .hi; + const y = .ok; + const z = .hi; + + expect(x != y); + expect(x == z); +} diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig index 8676c7628d..2d088fa261 100644 --- a/test/stage1/behavior/type_info.zig +++ b/test/stage1/behavior/type_info.zig @@ -190,7 +190,7 @@ fn testUnion() void { expect(TypeId(typeinfo_info) == TypeId.Union); expect(typeinfo_info.Union.layout == TypeInfo.ContainerLayout.Auto); expect(typeinfo_info.Union.tag_type.? == TypeId); - expect(typeinfo_info.Union.fields.len == 24); + expect(typeinfo_info.Union.fields.len == 25); expect(typeinfo_info.Union.fields[4].enum_field != null); expect(typeinfo_info.Union.fields[4].enum_field.?.value == 4); expect(typeinfo_info.Union.fields[4].field_type == @typeOf(@typeInfo(u8).Int)); |
