diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-07-26 19:52:35 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-07-26 19:52:35 -0400 |
| commit | ee64a22045ccbc39773779d4e386e25f563c8a90 (patch) | |
| tree | 95263984be9a72a1c9cc102b55e715a83a38b8eb /test/stage1 | |
| parent | 018a89c7a1b2763a50375f6d6d168dfa1f877f6a (diff) | |
| download | zig-ee64a22045ccbc39773779d4e386e25f563c8a90.tar.gz zig-ee64a22045ccbc39773779d4e386e25f563c8a90.zip | |
add the `anyframe` and `anyframe->T` types
Diffstat (limited to 'test/stage1')
| -rw-r--r-- | test/stage1/behavior/type_info.zig | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig index 6a51015124..b86ba27c13 100644 --- a/test/stage1/behavior/type_info.zig +++ b/test/stage1/behavior/type_info.zig @@ -177,11 +177,11 @@ 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 == 25); + expect(typeinfo_info.Union.fields.len == 26); 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)); - expect(typeinfo_info.Union.decls.len == 20); + expect(typeinfo_info.Union.decls.len == 21); const TestNoTagUnion = union { Foo: void, @@ -280,6 +280,25 @@ fn testVector() void { expect(vec_info.Vector.child == i32); } +test "type info: anyframe and anyframe->T" { + testAnyFrame(); + comptime testAnyFrame(); +} + +fn testAnyFrame() void { + { + const anyframe_info = @typeInfo(anyframe->i32); + expect(TypeId(anyframe_info) == .AnyFrame); + expect(anyframe_info.AnyFrame.child.? == i32); + } + + { + const anyframe_info = @typeInfo(anyframe); + expect(TypeId(anyframe_info) == .AnyFrame); + expect(anyframe_info.AnyFrame.child == null); + } +} + test "type info: optional field unwrapping" { const Struct = struct { cdOffset: u32, |
