diff options
| author | Brian Anderson <[email protected]> | 2011-04-18 20:58:45 -0400 |
|---|---|---|
| committer | Brian Anderson <[email protected]> | 2011-04-18 21:36:04 -0400 |
| commit | d4f1a48111673c158d1c9493be4a87eaa24064b1 (patch) | |
| tree | 08dddcf2a24b2b1a9b2dd4d4d61eccc33b4b0df3 /src/test | |
| parent | Boilerplate city, for anyone who wants it. (diff) | |
| download | rust-d4f1a48111673c158d1c9493be4a87eaa24064b1.tar.xz rust-d4f1a48111673c158d1c9493be4a87eaa24064b1.zip | |
Support 0 flag in #fmt
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/syntax-extension-fmt.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index 61143e4a..46d5036a 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -126,4 +126,21 @@ fn main() { // Plus overrides space test(#fmt("% +d", 0), "+0"); test(#fmt("%+ d", 0), "+0"); + + // 0-padding + test(#fmt("%05d", 0), "00000"); + test(#fmt("%05d", 1), "00001"); + test(#fmt("%05d", -1), "-0001"); + test(#fmt("%05u", 1u), "00001"); + test(#fmt("%05x", 127u), "0007f"); + test(#fmt("%05X", 127u), "0007F"); + test(#fmt("%05t", 3u), "00011"); + // 0-padding a string is undefined but glibc does this: + test(#fmt("%05s", "test"), " test"); + test(#fmt("%05b", true), " true"); + + // TODO: Left-justify overrides 0-padding + // TODO: Precision overrides 0-padding + // TODO: Padding and + + // TODO: Padding and ' ' } |