Skip to content

Commit 100b855

Browse files
committed
---
yaml --- r: 2231 b: refs/heads/master c: 66b59e4 h: refs/heads/master i: 2229: 56fde08 2227: f60deb8 2223: 57067a4 v: v3
1 parent 73911d9 commit 100b855

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: e77f5b1561092d9caa3a5423c569c1a2f8e44f99
2+
refs/heads/master: 66b59e4b056ade5f0a5e5a8fd64534aeea9b952c

trunk/src/lib/ExtFmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ mod RT {
382382
}
383383

384384
fn conv_char(&conv cv, char c) -> str {
385-
ret conv_str(cv, _str.from_char(c));
385+
ret pad(cv, _str.from_char(c), pad_nozero);
386386
}
387387

388388
fn conv_str(&conv cv, str s) -> str {

trunk/src/test/run-pass/syntax-extension-fmt.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn main() {
6767
test(#fmt("%.s", "test"), "");
6868
test(#fmt("%.x", 127u), "7f");
6969
test(#fmt("%.t", 3u), "11");
70-
test(#fmt("%.c", 'A'), "");
70+
test(#fmt("%.c", 'A'), "A");
7171

7272
test(#fmt("%.0d", 0), "");
7373
test(#fmt("%.0u", 0u), "");
@@ -79,7 +79,7 @@ fn main() {
7979
test(#fmt("%.0s", "test"), "");
8080
test(#fmt("%.0x", 127u), "7f");
8181
test(#fmt("%.0t", 3u), "11");
82-
test(#fmt("%.0c", 'A'), "");
82+
test(#fmt("%.0c", 'A'), "A");
8383

8484
test(#fmt("%.1d", 0), "0");
8585
test(#fmt("%.1u", 0u), "0");
@@ -137,6 +137,7 @@ fn main() {
137137
test(#fmt("%05t", 3u), "00011");
138138
// 0-padding a string is undefined but glibc does this:
139139
test(#fmt("%05s", "test"), " test");
140+
test(#fmt("%05c", 'A'), " A");
140141
test(#fmt("%05b", true), " true");
141142

142143
// Left-justify overrides 0-padding
@@ -148,6 +149,7 @@ fn main() {
148149
test(#fmt("%-05X", 127u), "7F ");
149150
test(#fmt("%-05t", 3u), "11 ");
150151
test(#fmt("%-05s", "test"), "test ");
152+
test(#fmt("%-05c", 'A'), "A ");
151153
test(#fmt("%-05b", true), "true ");
152154

153155
// Precision overrides 0-padding
@@ -158,6 +160,7 @@ fn main() {
158160
test(#fmt("%06.5d", -10), "-00010");
159161
test(#fmt("%06.5u", 10u), " 00010");
160162
test(#fmt("%06.5s", "test"), " test");
163+
test(#fmt("%06.5c", 'A'), " A");
161164
test(#fmt("%06.5x", 127u), " 0007f");
162165
test(#fmt("%06.5X", 127u), " 0007F");
163166

0 commit comments

Comments
 (0)