Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #12463 - stupendoussuperpowers:nocapture_test_msg, r=epage
prompt the use of `--nocapture` flag if `cargo test` process is terminated via a signal. Fixes #10855 As per the discussion on this issue, we want to prompt the user to use `--nocapture` if a test is terminated abnormally. The motivation for this change is described in the issue. We check for 3 things before we display this flag. - - `!is_simple` (if the test ended with a non 101 status code) - `harness` (if the standard test harness was used), and - `!nocapture` (whether or not the `--nocapture` flag was already passed to the test) There's further tests added to `test::nonzero_exit_status` that check that the `stderr` is correct for the various combinations possible when a test ends with a non-101 status code. The new expected behavior is - - Display `--nocapture` note for only non-zero exit statuses, when the `--nocapture` flag is not passed. - Only display the note if we use a standard test harness since custom test harnesses do not implement the `--nocapture` flag. To implement the check for the `--nocapture` flag, the function definition for `report_test_errors` was changed to add the `test_args: &[&str]` parameter. This parameter is passed from the immediate calling function. This private function is only called twice change and is not causing regression after making the appropriate changes to both the places it's called in.
- Loading branch information