mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Return error early if seconds part of timestamp is invalid (#6193)
Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
@ -180,6 +180,34 @@ fn errors_if_change_modified_time_of_file_with_invalid_timestamp() {
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -t 082412.3012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -t 0824.123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -t 08.24123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -t 0.824123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -401,6 +429,34 @@ fn errors_if_change_access_time_of_file_with_invalid_timestamp() {
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -a -t 082412.3012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -a -t 0824.123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -a -t 08.24123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -a -t 0.824123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -634,6 +690,34 @@ fn errors_if_change_modified_and_access_time_of_file_with_invalid_timestamp() {
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -a -t 082412.3012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -a -t 0824.123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -a -t 08.24123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
"touch -m -a -t 0.824123012 file.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user