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

Merge pull request #7274 from jfinkels/touch-obsolete-posix-args

touch: support obsolete POSIX timestamp argument
This commit is contained in:
Daniel Hofstetter 2025-02-08 15:24:23 +01:00 committed by GitHub
commit d86a7fb593
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 108 additions and 20 deletions

View file

@ -917,3 +917,27 @@ fn test_touch_reference_symlink_with_no_deref() {
// Times should be taken from the symlink, not the destination
assert_eq!((time, time), get_symlink_times(&at, arg));
}
#[test]
fn test_obsolete_posix_format() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.env("_POSIX2_VERSION", "199209")
.env("POSIXLY_CORRECT", "1")
.args(&["01010000", "11111111"])
.succeeds()
.no_output();
assert!(at.file_exists("11111111"));
assert!(!at.file_exists("01010000"));
}
#[test]
fn test_obsolete_posix_format_with_year() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.env("_POSIX2_VERSION", "199209")
.env("POSIXLY_CORRECT", "1")
.args(&["0101000090", "11111111"])
.succeeds()
.no_output();
assert!(at.file_exists("11111111"));
assert!(!at.file_exists("0101000090"));
}