Fix tests

This commit is contained in:
Chester Liu 2021-03-26 20:28:23 +08:00
parent 5503e4756e
commit 13b3635407
3 changed files with 1 additions and 8 deletions

View File

@ -594,10 +594,8 @@ mod filename_test {
}
#[test]
#[cfg(unix)]
fn topmost() {
#[cfg(unix)]
assert_eq!("/", File::filename(Path::new("/")));
#[cfg(windows)]
assert_eq!("C:\\", File::filename(Path::new("C:\\")));
}
}

View File

@ -185,7 +185,6 @@ pub enum SortField {
///
/// In original Unix, this was, however, meant as creation time.
/// https://www.bell-labs.com/usr/dmr/www/cacm.html
#[cfg(unix)]
ChangedDate,
/// The time the file was created (the “btime” or “birthtime”).
@ -257,7 +256,6 @@ impl SortField {
Self::FileInode => a.metadata.ino().cmp(&b.metadata.ino()),
Self::ModifiedDate => a.modified_time().cmp(&b.modified_time()),
Self::AccessedDate => a.accessed_time().cmp(&b.accessed_time()),
#[cfg(unix)]
Self::ChangedDate => a.changed_time().cmp(&b.changed_time()),
Self::CreatedDate => a.created_time().cmp(&b.created_time()),
Self::ModifiedAge => b.modified_time().cmp(&a.modified_time()), // flip b and a

View File

@ -78,15 +78,12 @@ impl SortField {
"age" | "old" | "oldest" => {
Self::ModifiedAge
}
#[cfg(unix)]
"ch" | "changed" => {
Self::ChangedDate
}
#[cfg(unix)]
"acc" | "accessed" => {
Self::AccessedDate
}
#[cfg(unix)]
"cr" | "created" => {
Self::CreatedDate
}