From d37cc4f796e17ffe3b97e5ac63c60caf887a4994 Mon Sep 17 00:00:00 2001 From: ChristianVisintin Date: Fri, 18 Dec 2020 12:27:37 +0100 Subject: [PATCH] test name elide in fs fmt --- CHANGELOG.md | 1 + src/fs/mod.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c947f16..15c7c26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Released on ?? - Bugfix: - File mode of file on remote is now reported on local file after being downloaded (unix, linux, macos only) - Scp: when username was not provided, it didn't fallback to current username + - Explorer: fixed UID format in Windows ## 0.1.3 diff --git a/src/fs/mod.rs b/src/fs/mod.rs index a3d90f0..3140a06 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -469,6 +469,37 @@ mod tests { time_to_str(t, "%b %d %Y %H:%M") ) ); + // Elide name + let entry: FsEntry = FsEntry::File(FsFile { + name: String::from("piroparoporoperoperupupu.txt"), + abs_path: PathBuf::from("/bar.txt"), + last_change_time: t, + last_access_time: t, + creation_time: t, + size: 8192, + readonly: false, + ftype: Some(String::from("txt")), + symlink: None, // UNIX only + user: Some(0), // UNIX only + group: Some(0), // UNIX only + unix_pex: Some((6, 4, 4)), // UNIX only + }); + #[cfg(any(target_os = "unix", target_os = "macos", target_os = "linux"))] + assert_eq!( + format!("{}", entry), + format!( + "piroparoporoperoperu... \t-rw-r--r-- \troot \t8.2 KB \t{}", + time_to_str(t, "%b %d %Y %H:%M") + ) + ); + #[cfg(target_os = "windows")] + assert_eq!( + format!("{}", entry), + format!( + "piroparoporoperoperu... \t-rw-r--r-- \t0 \t8.2 KB \t{}", + time_to_str(t, "%b %d %Y %H:%M") + ) + ); // No pex let entry: FsEntry = FsEntry::File(FsFile { name: String::from("bar.txt"),