From eaaaceaf3cc3bab5312fee780891eafa8129eafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=8EYuh?= <109846069+noiryuh@users.noreply.github.com> Date: Fri, 23 Sep 2022 16:20:38 +0700 Subject: [PATCH] make `fmt.formatAsciiChar` respect `options` parameter --- lib/std/fmt.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 932239c2dd..328b5229e0 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -1004,8 +1004,7 @@ pub fn formatAsciiChar( options: FormatOptions, writer: anytype, ) !void { - _ = options; - return writer.writeAll(@as(*const [1]u8, &c)); + return formatBuf(@as(*const [1]u8, &c), options, writer); } pub fn formatUnicodeCodepoint( @@ -2724,6 +2723,9 @@ test "padding" { try expectFmt("==crêpe===", "{s:=^10}", .{"crêpe"}); try expectFmt("=====crêpe", "{s:=>10}", .{"crêpe"}); try expectFmt("crêpe=====", "{s:=<10}", .{"crêpe"}); + try expectFmt("====a", "{c:=>5}", .{'a'}); + try expectFmt("==a==", "{c:=^5}", .{'a'}); + try expectFmt("a====", "{c:=<5}", .{'a'}); } test "decimal float padding" {