mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
Fix touch panics when using invalid timestamp (#6181)
Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
@ -766,3 +766,20 @@ fn not_create_file_if_it_not_exists() {
|
||||
assert!(!path.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_timestamp() {
|
||||
Playground::setup("test_invalid_timestamp", |dirs, _sandbox| {
|
||||
let outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
r#"touch -t 20220729. file.txt"#
|
||||
);
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
|
||||
let outcome = nu!(
|
||||
cwd: dirs.test(),
|
||||
r#"touch -t 20220729120099 file.txt"#
|
||||
);
|
||||
assert!(outcome.err.contains("input has an invalid timestamp"));
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user