mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
truncate: fix error message for file not found
Change the error message for when the reference file (the `-r` argument) is not found to match GNU coreutils. This commit also eliminates a redundant call to `File::open`; the file need not be opened because the size in bytes can be read from the result of `std::fs::metadata()`.
This commit is contained in:
parent
b9e99543db
commit
fc29846b45
2 changed files with 16 additions and 6 deletions
|
@ -245,3 +245,11 @@ fn test_invalid_numbers() {
|
|||
new_ucmd!().args(&["-s", "0XB", "file"]).fails().stderr_contains("Invalid number: ‘0XB’");
|
||||
new_ucmd!().args(&["-s", "0B", "file"]).fails().stderr_contains("Invalid number: ‘0B’");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reference_file_not_found() {
|
||||
new_ucmd!()
|
||||
.args(&["-r", "a", "b"])
|
||||
.fails()
|
||||
.stderr_contains("cannot stat 'a': No such file or directory");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue