mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
stage2: add test for fixed issue
This commit is contained in:
parent
8bf3e1f8d0
commit
989c0f55e8
@ -81,6 +81,7 @@ test {
|
||||
_ = @import("behavior/bugs/11159.zig");
|
||||
_ = @import("behavior/bugs/11162.zig");
|
||||
_ = @import("behavior/bugs/11165.zig");
|
||||
_ = @import("behavior/bugs/11179.zig");
|
||||
_ = @import("behavior/bugs/11181.zig");
|
||||
_ = @import("behavior/bugs/11182.zig");
|
||||
_ = @import("behavior/bugs/11213.zig");
|
||||
|
||||
18
test/behavior/bugs/11179.zig
Normal file
18
test/behavior/bugs/11179.zig
Normal file
@ -0,0 +1,18 @@
|
||||
const std = @import("std");
|
||||
const Type = std.builtin.Type;
|
||||
|
||||
test "Tuple" {
|
||||
const fields_list = fields(@TypeOf(.{}));
|
||||
if (fields_list.len != 0)
|
||||
@compileError("Argument count mismatch");
|
||||
}
|
||||
|
||||
pub fn fields(comptime T: type) switch (@typeInfo(T)) {
|
||||
.Struct => []const Type.StructField,
|
||||
else => unreachable,
|
||||
} {
|
||||
return switch (@typeInfo(T)) {
|
||||
.Struct => |info| info.fields,
|
||||
else => unreachable,
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user