authorgravatar for datamanrb@gmail.comdata-man <datamanrb@gmail.com> 2020-10-21 22:02:38+05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-10-26 15:40:48-04:00
log194e29adfccbd5076a3523572c7e119d4bfa647d
tree7a10c9a68cc57f36e59b94e12da47bd9d175cd4b
parenta0f4606f32bab6df88d0afc1bf9ff479470b68cc

Format null type in std.fmt


1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/fmt.zig+7
......@@ -496,6 +496,7 @@ pub fn formatType(
496496 const buffer = [_]u8{'.'} ++ @tagName(value);
497497 return formatType(buffer, fmt, options, writer, max_depth);
498498 },
499 .Null => return formatBuf("null", options, writer),
499500 else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),
500501 }
501502}
......@@ -1908,3 +1909,9 @@ test "sci float padding" {
19081909 try testFmt("center-pad: *3.141e+00*\n", "center-pad: {e:*^11.3}\n", .{number});
19091910 try testFmt("right-pad: 3.141e+00**\n", "right-pad: {e:*<11.3}\n", .{number});
19101911}
1912
1913test "null" {
1914 const inst = null;
1915 try testFmt("null", "{}", .{inst});
1916}
1917