File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -144,15 +144,20 @@ test "type info: enum info" {
144
144
}
145
145
146
146
fn testEnum () void {
147
- const Os = @import ("builtin" ).Os ;
147
+ const Os = enum {
148
+ Windows ,
149
+ Macos ,
150
+ Linux ,
151
+ FreeBSD ,
152
+ };
148
153
149
154
const os_info = @typeInfo (Os );
150
155
assert (TypeId (os_info ) == TypeId .Enum );
151
156
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 );
156
161
assert (os_info .Enum .defs .len == 0 );
157
162
}
158
163
You can’t perform that action at this time.
0 commit comments