diff options
| author | Brian Anderson <[email protected]> | 2011-04-17 17:24:17 -0400 |
|---|---|---|
| committer | Brian Anderson <[email protected]> | 2011-04-17 17:24:17 -0400 |
| commit | 1bec738c56c221843adbb022914c1de6e3bd7c61 (patch) | |
| tree | 2b5d86bb58bc138d1c1c10248a2a8b94f26a8a94 /src/test | |
| parent | Fix indentation in syntax-extension-fmt.rs (diff) | |
| download | rust-1bec738c56c221843adbb022914c1de6e3bd7c61.tar.xz rust-1bec738c56c221843adbb022914c1de6e3bd7c61.zip | |
Support #fmt precision for bools, with same rules as strings
Not totally confident this is desirable. The alternative would be to make it a
compile error.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/syntax-extension-fmt.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index 935c87c1..5c66b17a 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -104,4 +104,12 @@ fn main() { test(#fmt("%.5x", 127u), "0007f"); test(#fmt("%.5t", 3u), "00011"); test(#fmt("%.5c", 'A'), "A"); + + // Bool precision. I'm not sure if it's good or bad to have bool + // conversions support precision - it's not standard printf so we + // can do whatever. For now I'm making it behave the same as string + // conversions. + test(#fmt("%.b", true), ""); + test(#fmt("%.0b", true), ""); + test(#fmt("%.1b", true), "t"); } |