| author | |
| committer | |
| log | 4937aeff8448a512f5b305ac1c3f9c35354b5659 |
| tree | 5cbd934d5a38e15f2b66ae2c351c5d3671410c80 |
| parent | b2895f356fa6203d0f3f1476c4e8fb9cf5b6d860 |
| parent | b4b54b597d59b709b7d801db55c7705c8e950d4e |
| signature |
std.Io.Writer.print: support .enum_literal in 't' format specifier2 files changed, 2 insertions(+), 1 deletions(-)
lib/std/Io/Writer.zig+1-1| ... | ... | @@ -1161,7 +1161,7 @@ pub fn printValue( |
| 1161 | 1161 | }, |
| 1162 | 1162 | 't' => switch (@typeInfo(T)) { |
| 1163 | 1163 | .error_set => return w.alignBufferOptions(@errorName(value), options), |
| 1164 | .@"enum", .@"union" => return w.alignBufferOptions(@tagName(value), options), | |
| 1164 | .@"enum", .enum_literal, .@"union" => return w.alignBufferOptions(@tagName(value), options), | |
| 1165 | 1165 | else => invalidFmtError(fmt, value), |
| 1166 | 1166 | }, |
| 1167 | 1167 | else => {}, |
lib/std/fmt.zig+1| ... | ... | @@ -1249,6 +1249,7 @@ test "vector" { |
| 1249 | 1249 | |
| 1250 | 1250 | test "enum-literal" { |
| 1251 | 1251 | try expectFmt(".hello_world", "{}", .{.hello_world}); |
| 1252 | try expectFmt("hello_world", "{t}", .{.hello_world}); | |
| 1252 | 1253 | } |
| 1253 | 1254 | |
| 1254 | 1255 | test "padding" { |