mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 06:02:36 +00:00
Tweaked sort test to work on Windows
Windows doesn't have `touch`, but it does have Powershell, which can also change timestamps. The relevant command is: $(Get-Item name).lastwritetime=$(Get-Date "MM/DD/YYYY")
This commit is contained in:
parent
82bd588a05
commit
39b73daadf
1 changed files with 14 additions and 1 deletions
15
src/sort.rs
15
src/sort.rs
|
@ -189,6 +189,8 @@ mod tests {
|
|||
// Create the file;
|
||||
let path_z = tmp_dir.path().join("zzz");
|
||||
File::create(&path_z).expect("failed to create file");
|
||||
|
||||
#[cfg(unix)]
|
||||
let success = Command::new("touch")
|
||||
.arg("-t")
|
||||
.arg("198511160000")
|
||||
|
@ -196,7 +198,18 @@ mod tests {
|
|||
.status()
|
||||
.unwrap()
|
||||
.success();
|
||||
assert_eq!(true, success, "failed to exec mkfifo");
|
||||
|
||||
#[cfg(windows)]
|
||||
let success = Command::new("powershell")
|
||||
.arg("-Command")
|
||||
.arg("$(Get-Item")
|
||||
.arg(&path_z)
|
||||
.arg(").lastwritetime=$(Get-Date \"11/16/1985\")")
|
||||
.status()
|
||||
.unwrap()
|
||||
.success();
|
||||
|
||||
assert_eq!(true, success, "failed to change file timestamp");
|
||||
let meta_z = Meta::from_path(&path_z).expect("failed to get meta");
|
||||
|
||||
let mut flags = Flags::default();
|
||||
|
|
Loading…
Reference in a new issue