mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
parent
c41ac8f19e
commit
3c046ab9d9
1 changed files with 7 additions and 0 deletions
|
|
@ -67,4 +67,11 @@ test "*T to *[1]T" {
|
||||||
try expect(z[0] == 1234);
|
try expect(z[0] == 1234);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sentinel-terminated slices can be coerced into sentinel-terminated pointers
|
||||||
|
test "[:x]T to [*:x]T" {
|
||||||
|
const buf: [:0]const u8 = "hello";
|
||||||
|
const buf2: [*:0]const u8 = buf;
|
||||||
|
try expect(buf2[4] == 'o');
|
||||||
|
}
|
||||||
|
|
||||||
// test
|
// test
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue