Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- the text output now uses the singular form when there was 1 unmatched diagnostic

### Changed

- DependencyBuilder: if `config.target` is set (which is always the case if you use `run_tests_generic`),
Expand Down
17 changes: 12 additions & 5 deletions src/status_emitter/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crossbeam_channel::{Sender, TryRecvError};
#[cfg(feature = "indicatif")]
use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressStyle};
use spanned::Span;
use std::borrow::Cow;
use std::fmt::{Debug, Display};
use std::io::Write as _;
use std::path::Path;
Expand Down Expand Up @@ -765,19 +766,25 @@ fn print_error(error: &Error, path: &Path) {
})
.collect::<Vec<_>>();
// This will print a suitable error header.

let error_msg: Cow<str> = match msgs.len() {
1 => "there was 1 unmatched diagnostic".into(),
n => format!("there were {n} unmatched diagnostics").into(),
};
create_error(
format!("there were {} unmatched diagnostics", msgs.len()),
error_msg,
&[&msgs
.iter()
.map(|(msg, lc)| (msg.as_ref(), lc.clone()))
.collect::<Vec<_>>()],
path,
);
} else {
print_error_header(format_args!(
"there were {} unmatched diagnostics that occurred outside the testfile and had no pattern",
msgs.len(),
));
let error_msg: Cow<str> = match msgs.len() {
1 => "there was 1 unmatched diagnostic that occurred outside the testfile and had no pattern".into(),
n => format!("there were {n} unmatched diagnostics that occurred outside the testfile and had no pattern").into(),
};
print_error_header(error_msg);
for Message {
level,
message,
Expand Down
Loading