mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 11:36:16 +00:00
Merge pull request #2221 from jfinkels/head-display-multiple-errors-2
head: display errors for each input file instead of terminating at the first error
This commit is contained in:
commit
efb781f59a
3 changed files with 52 additions and 40 deletions
|
@ -162,6 +162,18 @@ fn test_no_such_file_or_directory() {
|
|||
.stderr_contains("cannot open 'no_such_file.toml' for reading: No such file or directory");
|
||||
}
|
||||
|
||||
/// Test that each non-existent files gets its own error message printed.
|
||||
#[test]
|
||||
fn test_multiple_nonexistent_files() {
|
||||
new_ucmd!()
|
||||
.args(&["bogusfile1", "bogusfile2"])
|
||||
.fails()
|
||||
.stdout_does_not_contain("==> bogusfile1 <==")
|
||||
.stderr_contains("cannot open 'bogusfile1' for reading: No such file or directory")
|
||||
.stdout_does_not_contain("==> bogusfile2 <==")
|
||||
.stderr_contains("cannot open 'bogusfile2' for reading: No such file or directory");
|
||||
}
|
||||
|
||||
// there was a bug not caught by previous tests
|
||||
// where for negative n > 3, the total amount of lines
|
||||
// was correct, but it would eat from the second line
|
||||
|
|
|
@ -315,7 +315,12 @@ impl CmdResult {
|
|||
}
|
||||
|
||||
pub fn stdout_does_not_contain<T: AsRef<str>>(&self, cmp: T) -> &CmdResult {
|
||||
assert!(!self.stdout_str().contains(cmp.as_ref()));
|
||||
assert!(
|
||||
!self.stdout_str().contains(cmp.as_ref()),
|
||||
"'{}' contains '{}' but should not",
|
||||
self.stdout_str(),
|
||||
cmp.as_ref(),
|
||||
);
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue