diff options
| author | bors <bors@rust-lang.org> | 2020-01-15 13:00:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-15 13:00:43 +0000 |
| commit | 6d0bb91bcba33a70fae4b0c663fb4403ed78f071 (patch) | |
| tree | 49ad0d439dbcdc46e462fc95d9186c46d4c37421 /src/libcore/tests | |
| parent | c74353c7d2e61b111a9241490b9fbbd1ebe491fe (diff) | |
| parent | d2840e6bf11969c8b0275149cda25f6ce4ee60ac (diff) | |
| download | rust-6d0bb91bcba33a70fae4b0c663fb4403ed78f071.tar.gz rust-6d0bb91bcba33a70fae4b0c663fb4403ed78f071.zip | |
Auto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor
Rollup of 12 pull requests Successful merges: - #67784 (Reset Formatter flags on exit from pad_integral) - #67914 (Don't run const propagation on items with inconsistent bounds) - #68141 (use winapi for non-stdlib Windows bindings) - #68211 (Add failing example for E0170 explanation) - #68219 (Untangle ZST validation from integer validation and generalize it to all zsts) - #68222 (Update the wasi-libc bundled with libstd) - #68226 (Avoid calling tcx.hir().get() on CRATE_HIR_ID) - #68227 (Update to a version of cmake with windows arm64 support) - #68229 (Update iovec to a version with no winapi dependency) - #68230 (Update libssh2-sys to a version that can build for aarch64-pc-windows…) - #68231 (Better support for cross compilation on Windows.) - #68233 (Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore/tests')
| -rw-r--r-- | src/libcore/tests/fmt/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/tests/fmt/mod.rs b/src/libcore/tests/fmt/mod.rs index d86e21cf40b..7b281ce48e6 100644 --- a/src/libcore/tests/fmt/mod.rs +++ b/src/libcore/tests/fmt/mod.rs @@ -28,3 +28,18 @@ fn test_estimated_capacity() { assert_eq!(format_args!("{}, hello!", "World").estimated_capacity(), 0); assert_eq!(format_args!("{}. 16-bytes piece", "World").estimated_capacity(), 32); } + +#[test] +fn pad_integral_resets() { + struct Bar; + + impl core::fmt::Display for Bar { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + "1".fmt(f)?; + f.pad_integral(true, "", "5")?; + "1".fmt(f) + } + } + + assert_eq!(format!("{:<03}", Bar), "1 0051 "); +} |
