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] #[test]
#[cfg(unix)]
fn topmost() { fn topmost() {
#[cfg(unix)]
assert_eq!("/", File::filename(Path::new("/"))); 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. /// In original Unix, this was, however, meant as creation time.
/// https://www.bell-labs.com/usr/dmr/www/cacm.html /// https://www.bell-labs.com/usr/dmr/www/cacm.html
#[cfg(unix)]
ChangedDate, ChangedDate,
/// The time the file was created (the “btime” or “birthtime”). /// 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::FileInode => a.metadata.ino().cmp(&b.metadata.ino()),
Self::ModifiedDate => a.modified_time().cmp(&b.modified_time()), Self::ModifiedDate => a.modified_time().cmp(&b.modified_time()),
Self::AccessedDate => a.accessed_time().cmp(&b.accessed_time()), Self::AccessedDate => a.accessed_time().cmp(&b.accessed_time()),
#[cfg(unix)]
Self::ChangedDate => a.changed_time().cmp(&b.changed_time()), Self::ChangedDate => a.changed_time().cmp(&b.changed_time()),
Self::CreatedDate => a.created_time().cmp(&b.created_time()), Self::CreatedDate => a.created_time().cmp(&b.created_time()),
Self::ModifiedAge => b.modified_time().cmp(&a.modified_time()), // flip b and a Self::ModifiedAge => b.modified_time().cmp(&a.modified_time()), // flip b and a

View File

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