about summary refs log tree commit diff
path: root/src/libcore/tests/fmt
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-1030/+0
2020-04-05Stop importing int/float modules in libcoreLinus Färnstrand-4/+0
2020-02-14implement LowerExp and UpperExp for integersMax Blachman-0/+80
2020-01-17Auto merge of #66716 - derekdreery:debug_non_exhaustive, r=dtolnaybors-0/+85
Implement `DebugStruct::non_exhaustive`. This patch adds a function (finish_non_exhaustive) to add ellipsis before the closing brace when formatting using `DebugStruct`. ## Example ```rust #![feature(debug_non_exhaustive)] use std::fmt; struct Bar { bar: i32, hidden: f32, } impl fmt::Debug for Bar { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Bar") .field("bar", &self.bar) .non_exhaustive(true) // Show that some other field(s) exist. .finish() } } assert_eq!( format!("{:?}", Bar { bar: 10, hidden: 1.0 }), "Bar { bar: 10, .. }", ); ```
2020-01-16Rust ./x.py fmtRichard Dodd-12/+14
2020-01-14Implement `finish_non_exhaustive` for `DebugStruct`.Richard Dodd-0/+83
2020-01-01Reset Formatter flags on exit from pad_integralMark Rousskov-0/+15
This fixes a bug where after calling pad_integral with appropriate flags, the fill and alignment flags would be set to '0' and 'Right' and left as such even after exiting pad_integral, which meant that future calls on the same Formatter would get incorrect flags reported. This is quite difficult to observe in practice, as almost all formatting implementations in practice don't call `Display::fmt` directly, but rather use `write!` or a similar macro, which means that they cannot observe the effects of the wrong flags (as `write!` creates a fresh Formatter instance). However, we include a test case.
2019-12-22Format the worldMark Rousskov-125/+110
2019-10-10move debug_map assertions after check for errAshley Mannix-0/+40
2019-07-09Rollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichtonMazdak Farrokhzad-8/+85
Add key and value methods to DebugMap Implementation PR for an active (not approved) RFC: https://github.com/rust-lang/rfcs/pull/2696. Add two new methods to `std::fmt::DebugMap` for writing the key and value part of a map entry separately: ```rust impl<'a, 'b: 'a> DebugMap<'a, 'b> { pub fn key(&mut self, key: &dyn Debug) -> &mut Self; pub fn value(&mut self, value: &dyn Debug) -> &mut Self; } ``` I want to do this so that I can write a `serde::Serializer` that forwards to our format builders, so that any `T: Serialize` can also be treated like a `T: Debug`.
2019-07-08add key and value methods to DebugMapAshley Mannix-8/+85
2019-07-03enable a few more tests in Miri and update the comment for othersRalf Jung-2/+0
2019-04-20Deny rust_2018_idioms in libcore testsPhilipp Hansch-25/+25
2019-04-05Include trailing comma in multiline Debug representationDavid Tolnay-26/+26
This commit changes the behavior of Formatter::debug_struct, debug_tuple, debug_list, debug_set, and debug_map to render trailing commas in {:#?} mode, which is the dominant style in modern Rust code. Before: Language { name: "Rust", trailing_commas: false } After: Language { name: "Rust", trailing_commas: true, }
2019-03-12Replace assert with assert_eq for better debuggingSayan Nandan-118/+118
2019-02-13review failures in btree, stringRalf Jung-1/+0
2019-02-13the formatting issue got fixedRalf Jung-2/+3
2019-02-13review or fix remaining miri failures in libcoreRalf Jung-1/+1
2019-02-07disable tests in MiriRalf Jung-0/+2
2018-12-25Remove licensesMark Rousskov-40/+0
2018-03-13Add hexadecimal formatting of integers with fmt::DebugSimon Sapin-0/+6
This can be used for integers within a larger types which implements Debug (possibly through derive) but not fmt::UpperHex or fmt::LowerHex. ```rust assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]"); assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]"); ``` RFC: https://github.com/rust-lang/rfcs/pull/2226
2017-12-20Rollup merge of #46831 - Diggsey:float-debug-fmt, r=dtolnaykennytm-0/+4
Always `Debug` floats with a decimal point Fixes #30967 r? @dtolnay
2017-12-19Always print floats with a decimal point with the Debug formatterDiggory Blake-0/+4
2017-11-24Make fmt::DebugList and friends forward formatting parametersSimon Sapin-0/+55
For example, formatting slice of integers with `{:04?}` should zero-pad each integer.
2017-04-03Move libXtest into libX/testsStjepan Glavina-0/+727
This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561.