From 416ad517fe0ac4760084f29ec3d4c288b78f2f5a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 21 Jan 2020 17:13:47 -0600 Subject: [PATCH] Tests ~ fix windows testing --- src/tests.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index 3a0f980..4bd38e9 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -75,6 +75,31 @@ fn main_output(short_paths: bool) -> String { ) } +#[cfg(target_os = "windows")] +fn main_output(short_paths: bool) -> String { + let d = DisplayData { + short_paths, + is_reversed: false, + colors_on: true, + }; + format!( + "{} +{} +{} +{}", + format_string("src/test_dir", true, &d, " 6B", "─┬"), + format_string("src/test_dir\\many", true, &d, " 6B", " └─┬",), + format_string( + "src/test_dir\\many\\hello_file", + true, + &d, + " 6B", + " ├──", + ), + format_string("src/test_dir\\many\\a_file", false, &d, " 0B", " └──",), + ) +} + #[test] pub fn test_no_color_flag() { assert_cli::Assert::main_binary() @@ -106,6 +131,17 @@ fn no_color_flag_output() -> String { .to_string() } +#[cfg(target_os = "windows")] +fn no_color_flag_output() -> String { + " + 6B ─┬ test_dir + 6B └─┬ many + 6B ├── hello_file + 0B └── a_file + " + .to_string() +} + #[test] pub fn test_apparent_size() { let d = DisplayData { @@ -300,6 +336,19 @@ fn no_substring_of_names_output() -> String { .into() } +#[cfg(target_os = "windows")] +fn no_substring_of_names_output() -> String { + " + 16B ─┬ test_dir2 + 6B ├─┬ dir_substring + 6B │ └── hello + 5B ├─┬ dir + 5B │ └── hello + 5B └── dir_name_clash + " + .into() +} + // Check against directories and files whos names are substrings of each other #[test] pub fn test_ignore_dir() { @@ -331,3 +380,14 @@ fn ignore_dir_output() -> String { " .into() } + +#[cfg(target_os = "windows")] +fn ignore_dir_output() -> String { + " + 10B ─┬ test_dir2 + 5B ├─┬ dir + 5B │ └── hello + 5B └── dir_name_clash + " + .into() +}