Skip to content

Commit 2801870

Browse files
committed
tests: make type info tests not depend on builtin.Os enum
1 parent 45081c1 commit 2801870

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/cases/type_info.zig

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,20 @@ test "type info: enum info" {
144144
}
145145

146146
fn testEnum() void {
147-
const Os = @import("builtin").Os;
147+
const Os = enum {
148+
Windows,
149+
Macos,
150+
Linux,
151+
FreeBSD,
152+
};
148153

149154
const os_info = @typeInfo(Os);
150155
assert(TypeId(os_info) == TypeId.Enum);
151156
assert(os_info.Enum.layout == TypeInfo.ContainerLayout.Auto);
152-
assert(os_info.Enum.fields.len == 32);
153-
assert(mem.eql(u8, os_info.Enum.fields[1].name, "ananas"));
154-
assert(os_info.Enum.fields[10].value == 10);
155-
assert(os_info.Enum.tag_type == u5);
157+
assert(os_info.Enum.fields.len == 4);
158+
assert(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
159+
assert(os_info.Enum.fields[3].value == 3);
160+
assert(os_info.Enum.tag_type == u2);
156161
assert(os_info.Enum.defs.len == 0);
157162
}
158163

0 commit comments

Comments
 (0)