mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
parent
343249efd8
commit
a471a57560
@ -537,7 +537,7 @@ pub fn formatType(
|
||||
.Fn => {
|
||||
return format(writer, "{}@{x}", .{ @typeName(T), @ptrToInt(value) });
|
||||
},
|
||||
.Type => return writer.writeAll(@typeName(T)),
|
||||
.Type => return formatBuf(@typeName(value), options, writer),
|
||||
.EnumLiteral => {
|
||||
const buffer = [_]u8{'.'} ++ @tagName(value);
|
||||
return formatType(buffer, fmt, options, writer, max_depth);
|
||||
@ -2052,6 +2052,12 @@ test "null" {
|
||||
try testFmt("null", "{}", .{inst});
|
||||
}
|
||||
|
||||
test "type" {
|
||||
try testFmt("u8", "{}", .{u8});
|
||||
try testFmt("?f32", "{}", .{?f32});
|
||||
try testFmt("[]const u8", "{}", .{[]const u8});
|
||||
}
|
||||
|
||||
test "named arguments" {
|
||||
try testFmt("hello world!", "{} world{c}", .{ "hello", '!' });
|
||||
try testFmt("hello world!", "{[greeting]} world{[punctuation]c}", .{ .punctuation = '!', .greeting = "hello" });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user