mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
split test for 32 and 64 bits systems
This commit is contained in:
parent
7632acfc90
commit
57d0157c6a
1 changed files with 24 additions and 0 deletions
|
@ -119,8 +119,11 @@ fn test_touch_set_mdhms_time() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
fn test_touch_2_digit_years_68() {
|
||||
// 68 and before are 20xx
|
||||
// it will fail on 32 bits, because of wraparound for anything after
|
||||
// 2038-01-19
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "test_touch_set_two_digit_68_time";
|
||||
|
||||
|
@ -138,6 +141,27 @@ fn test_touch_2_digit_years_68() {
|
|||
assert_eq!(mtime, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_touch_2_digit_years_2038() {
|
||||
// Same as test_touch_2_digit_years_68 but for 32 bits systems
|
||||
// we test a date before the y2038 bug
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "test_touch_set_two_digit_68_time";
|
||||
|
||||
ucmd.args(&["-t", "3801010000", file])
|
||||
.succeeds()
|
||||
.no_output();
|
||||
|
||||
assert!(at.file_exists(file));
|
||||
|
||||
// January 1, 2038, 00:00:00
|
||||
let expected = FileTime::from_unix_time(2_145_916_800, 0);
|
||||
let (atime, mtime) = get_file_times(&at, file);
|
||||
assert_eq!(atime, mtime);
|
||||
assert_eq!(atime, expected);
|
||||
assert_eq!(mtime, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_touch_2_digit_years_69() {
|
||||
// 69 and after are 19xx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue