mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-16 19:56:17 +00:00
touch: implement -
(#3158)
This commit is contained in:
parent
90cc2bff6a
commit
103dffc12e
4 changed files with 122 additions and 3 deletions
|
@ -510,6 +510,27 @@ fn test_touch_no_such_file_error_msg() {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_touch_changes_time_of_file_in_stdout() {
|
||||
// command like: `touch - 1< ./c`
|
||||
// should change the timestamp of c
|
||||
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "test_touch_changes_time_of_file_in_stdout";
|
||||
|
||||
at.touch(file);
|
||||
assert!(at.file_exists(file));
|
||||
let (_, mtime) = get_file_times(&at, file);
|
||||
|
||||
ucmd.args(&["-"])
|
||||
.set_stdout(at.make_file(file))
|
||||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
let (_, mtime_after) = get_file_times(&at, file);
|
||||
assert!(mtime_after != mtime);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_touch_permission_denied_error_msg() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue