mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-05-21 08:32:02 +03:00
@@ -61,6 +61,21 @@ fn testUnknownLenPtr() void {
|
||||
expect(u32_ptr_info.Pointer.child == f64);
|
||||
}
|
||||
|
||||
test "type info: C pointer type info" {
|
||||
testCPtr();
|
||||
comptime testCPtr();
|
||||
}
|
||||
|
||||
fn testCPtr() void {
|
||||
const ptr_info = @typeInfo([*c]align(4) const i8);
|
||||
expect(TypeId(ptr_info) == TypeId.Pointer);
|
||||
expect(ptr_info.Pointer.size == TypeInfo.Pointer.Size.C);
|
||||
expect(ptr_info.Pointer.is_const);
|
||||
expect(!ptr_info.Pointer.is_volatile);
|
||||
expect(ptr_info.Pointer.alignment == 4);
|
||||
expect(ptr_info.Pointer.child == i8);
|
||||
}
|
||||
|
||||
test "type info: slice type info" {
|
||||
testSlice();
|
||||
comptime testSlice();
|
||||
|
||||
Reference in New Issue
Block a user