1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

truncate: better error msg when dir does not exist

Improve the error message that gets printed when a directory does not
exist. After this commit, the error message is

    truncate: cannot open '{file}' for writing: No such file or directory

where `{file}` is the name of a file in a directory that does not
exist.
This commit is contained in:
Jeffrey Finkelstein 2022-01-28 21:21:37 -05:00
parent f1d72018d7
commit c780c96e17
2 changed files with 18 additions and 3 deletions

View file

@ -377,3 +377,12 @@ fn test_division_by_zero_reference_and_size() {
.no_stdout()
.stderr_contains("division by zero");
}
#[test]
fn test_no_such_dir() {
new_ucmd!()
.args(&["-s", "0", "a/b"])
.fails()
.no_stdout()
.stderr_contains("cannot open 'a/b' for writing: No such file or directory");
}