about summary refs log tree commit diff
path: root/library/test/src/formatters
AgeCommit message (Collapse)AuthorLines
2025-08-04Add new `test::print_merged_doctests_times` used by rustdoc to display more ↵Guillaume Gomez-0/+46
detailed time information and add new `OutputFormatter::write_merged_doctests_times` method to handle it
2025-02-28Use correct error message casing for `io::const_error`sNoratrieb-3/+3
Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter. I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them. See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-02-10Use io::const_error! when possible over io::Error::newThalia Archibald-3/+3
2025-01-20test: add `#![warn(unreachable_pub)]`Urgau-26/+26
2024-07-29Reformat `use` declarations.Nicholas Nethercote-40/+33
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-06emit fractional benchmark nanoseconds in libtest's JSON output formatThe 8472-2/+2
2024-03-07Rust is a proper name: rust → RustRalf Jung-1/+1
2024-03-04libtest: Print the names of failed tests eagerlyjyn-7/+28
Previously, libtest would wait until all tests finished running to print the progress, which made it annoying to run many tests at once (since you don't know which have failed). Change it to print the names as soon as they fail. This also adds a test for the terse output; previously it was untested.
2023-07-23match on chars instead of &strs for .split() or .strip_prefix()Matthias Krüger-1/+1
2023-05-04Rollup merge of #110651 - durin42:xunit-stdout, r=cuviperMatthias Krüger-5/+35
libtest: include test output in junit xml reports Fixes #110336.
2023-05-01Ensure test library issues json string line-by-lineRaoul Strackx-70/+62
2023-04-28junit: fix typo in comment and don't include output for passes when not ↵Augie Fackler-2/+2
requested
2023-04-28handle cfg(bootstrap)Pietro Albini-16/+0
2023-04-21junit: also include per-case stdout in xmlAugie Fackler-5/+35
By placing the stdout in a CDATA block we avoid almost all escaping, as there's only two byte sequences you can't sneak into a CDATA and you can handle that with some only slightly regrettable CDATA-splitting. I've done this in at least two other implementations of the junit xml format over the years and it's always worked out. The only quirk new to this (for me) is smuggling newlines as 
 to avoid literal newlines in the output.
2023-03-15Implementing "<test_binary> --list --format json" #107307 #49359Partha P. Das-5/+110
2023-01-22Print why a test was ignored if it's the only test specified.Lenko Donchev-0/+9
2023-01-03Fix a few clippy lints in libtestJoshua Nelson-35/+35
- Remove unnecessary references and dereferences - Use `.contains` instead of `a <= x && x <= b` - Use `mem::take` instead of `mem::replace` where possible
2022-12-19Fix `uninlined_format_args` in libtestnils-6/+5
2022-04-07Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrumbors-22/+11
Bump bootstrap compiler to 1.61.0 beta This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments. r? `@Mark-Simulacrum`
2022-04-06Improve terse test output.Nicholas Nethercote-3/+4
The current terse output gives 112 chars per line, which causes wraparound for people using 100 char wide terminals, which is very common. This commit changes it to be exactly 100 wide, which makes the output look much nicer.
2022-04-05trivial cfg(bootstrap) changesPietro Albini-22/+11
2022-03-29Remove unnecessary .as_ref().Mara Bos-1/+1
2022-03-29Refactor after reviewAntonio Yang-22/+14
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2022-03-11Show ignore message in console and json outputAntonio Yang-5/+35
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-16/+16
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-02-17Rollup merge of #93479 - smoelius:master, r=yaahcMatthias Krüger-1/+1
Use `optflag` for `--report-time` Essentially, what is described here: https://github.com/rust-lang/rust/issues/64888#issuecomment-1008047228 There is one difference. The comment proposes to add a `--report-time-color` option. This change instead uses libtest's existing `--color` option for that purpose.
2022-02-07Rollup merge of #93416 - name1e5s:chore/remove_allow_fail, r=m-ou-seMara Bos-55/+10
remove `allow_fail` test flag close #93345
2022-02-02fix: Remove extra newlines from junit outputSerg Tereshchenko-2/+1
2022-01-30Use `optflag` for `--report-time`Samuel E. Moelius III-1/+1
Essentially, what is described here: https://github.com/rust-lang/rust/issues/64888#issuecomment-1008047228 There is one difference. The comment proposes to add a `--report-time-color` option. This change instead uses libtest's existing `--color` option for that purpose.
2022-01-28remove allow_fail test flagyuhaixin.hx-55/+10
2021-11-04clippy::perf fixesMatthias Krüger-2/+2
2021-10-07Rollup merge of #89082 - smoelius:master, r=kennytmJubilee-9/+28
Implement #85440 (Random test ordering) This PR adds `--shuffle` and `--shuffle-seed` options to `libtest`. The options are similar to the [`-shuffle` option](https://github.com/golang/go/blob/c894b442d1e5e150ad33fa3ce13dbfab1c037b3a/src/testing/testing.go#L1482-L1499) that was recently added to Go. Here are the relevant parts of the help message: ``` --shuffle Run tests in random order --shuffle-seed SEED Run tests in random order; seed the random number generator with SEED ... By default, the tests are run in alphabetical order. Use --shuffle or set RUST_TEST_SHUFFLE to run the tests in random order. Pass the generated "shuffle seed" to --shuffle-seed (or set RUST_TEST_SHUFFLE_SEED) to run the tests in the same order again. Note that --shuffle and --shuffle-seed do not affect whether the tests are run in parallel. ``` Is an RFC needed for this?
2021-09-29Implement #85440Samuel E. Moelius III-9/+28
2021-09-27Apply suggestions from code reviewJane Lusby-2/+2
Co-authored-by: kennytm <kennytm@gmail.com>
2021-09-24make junit output more consistent with default formatJane Lusby-1/+4
2021-09-11don't clone types that are Copy (clippy::clone_on_copy)Matthias Krüger-1/+1
2021-07-18Fix compilation errors.Charles Lew-0/+2
2021-06-17Use as_secs_f64 in JunitFormatterDeadbeef-4/+4
2021-06-06Auto merge of #84863 - ABouttefeux:libtest, r=m-ou-sebors-2/+10
Show test type during prints Test output can sometimes be confusing. For example doctest with the no_run argument are displayed the same way than test that are run. During #83857 I got the feedback that test output can be confusing. For the moment test output is ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) ... ok test $DIR/test-type.rs - f (line 21) ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` I propose to change output by indicating the test type as ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) - compile ... ok test $DIR/test-type.rs - f (line 21) - compile fail ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` by indicating the test type after the test name (and in the case of doctest after the function name and line) and before the "...". ------------ Note: this is a proof of concept, the implementation is probably not optimal as the properties added in `TestDesc` are only use in the display and does not represent actual change of behavior, maybe `TestType::DocTest` could have fields
2021-05-18change based on reviewAliénore Bouttefeux-8/+6
2021-05-16remove mode for run and ignore testsAliénore Bouttefeux-2/+12
2021-05-09add bootstrap cfgAliénore Bouttefeux-2/+2
2021-05-03change based on reviewAliénore Bouttefeux-2/+2
2021-05-03proof of concept add test type on printsAliénore Bouttefeux-2/+2
2021-04-30Better output for junit formatterAndrey Cherkashin-12/+52
2021-04-26Update junit.rsAndrey Cherkashin-1/+1
2021-04-25feat(libtest): Add JUnit formatterAndrey Cherkashin-0/+136
2021-02-21test: Print test name only once on timeoutTomasz Miąsko-4/+0
Pretty formatter when using multiple test threads displays test name twice on timeout event. This implicitly suggest that those are two different events, while in fact they are always printed together. Print test name only once. Before: ``` running 3 tests test src/lib.rs - c (line 16) ... ok test src/lib.rs - a (line 3) ... ok test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds test src/lib.rs - b (line 9) ... ok ``` After: ``` running 3 tests test src/lib.rs - c (line 16) ... ok test src/lib.rs - a (line 3) ... ok test src/lib.rs - b (line 9) has been running for over 60 seconds test src/lib.rs - b (line 9) ... ok ```
2020-11-27libtest: Print the total time taken to execute a test suiteJakob Schikowski-8/+29
2020-10-23Rollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAusYuki Okushi-4/+10
Fixing escaping to ensure generation of welformed json. doc tests' json name have a filename in them. When json test output is asked for on windows currently produces invalid json. Tracking issue for json test output: #49359