update behavior tests and compile error tests

This commit is contained in:
Andrew Kelley
2022-01-31 22:33:49 -07:00
parent 75bbc74d56
commit 4d22fa5a2a
4 changed files with 2 additions and 38 deletions

View File

@@ -0,0 +1 @@
export const foo = @typeInfo(@This()).Struct.decls;

View File

@@ -286,10 +286,6 @@ fn testStruct() !void {
try expect(struct_info.Struct.fields[3].alignment == 1);
try expect(struct_info.Struct.decls.len == 2);
try expect(struct_info.Struct.decls[0].is_pub);
try expect(!struct_info.Struct.decls[0].data.Fn.is_extern);
try expect(struct_info.Struct.decls[0].data.Fn.lib_name == null);
try expect(struct_info.Struct.decls[0].data.Fn.return_type == void);
try expect(struct_info.Struct.decls[0].data.Fn.fn_type == fn (*const TestStruct) void);
}
const TestUnpackedStruct = struct {
@@ -420,34 +416,6 @@ test "type info: TypeId -> TypeInfo impl cast" {
_ = comptime passTypeInfo(TypeId.Void);
}
test "type info: extern fns with and without lib names" {
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
const S = struct {
extern fn bar1() void;
extern "cool" fn bar2() void;
};
const info = @typeInfo(S);
comptime {
for (info.Struct.decls) |decl| {
if (std.mem.eql(u8, decl.name, "bar1")) {
try expect(decl.data.Fn.lib_name == null);
} else {
try expectEqualStrings("cool", decl.data.Fn.lib_name.?);
}
}
}
}
test "data field is a compile-time value" {
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
const S = struct {
const Bar = @as(isize, -1);
};
comptime try expect(@typeInfo(S).Struct.decls[0].data.Var == isize);
}
test "sentinel of opaque pointer type" {
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO