diff --git a/src/git_theme.rs b/src/git_theme.rs index 27bd965e6..294f6cbdb 100644 --- a/src/git_theme.rs +++ b/src/git_theme.rs @@ -29,3 +29,28 @@ impl GitTheme { symbol.to_string() } } + +#[test] +fn test_git_get_symbol() { + let git_theme = GitTheme::new(); + let mut git_status = GitStatus::Default; + assert_eq!(git_theme.get_symbol(&git_status), "-".to_string()); + git_status = GitStatus::Unmodified; + assert_eq!(git_theme.get_symbol(&git_status), ".".to_string()); + git_status = GitStatus::Ignored; + assert_eq!(git_theme.get_symbol(&git_status), "I".to_string()); + git_status = GitStatus::NewInIndex; + assert_eq!(git_theme.get_symbol(&git_status), "N".to_string()); + git_status = GitStatus::NewInWorkdir; + assert_eq!(git_theme.get_symbol(&git_status), "?".to_string()); + git_status = GitStatus::Typechange; + assert_eq!(git_theme.get_symbol(&git_status), "T".to_string()); + git_status = GitStatus::Deleted; + assert_eq!(git_theme.get_symbol(&git_status), "D".to_string()); + git_status = GitStatus::Renamed; + assert_eq!(git_theme.get_symbol(&git_status), "R".to_string()); + git_status = GitStatus::Modified; + assert_eq!(git_theme.get_symbol(&git_status), "M".to_string()); + git_status = GitStatus::Conflicted; + assert_eq!(git_theme.get_symbol(&git_status), "C".to_string()); +} diff --git a/src/main.rs b/src/main.rs index 1f7dd227c..4fb44c6aa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -124,3 +124,14 @@ fn main() { let exit_code = core.run(cli.inputs); std::process::exit(exit_code as i32); } + +#[test] +fn test_print_output() { + let path = std::path::Path::new("."); + std::process::Command::new("lsd") + .arg(path.as_os_str()) + .spawn() + .expect("lsd command failed") + .wait() + .expect("wait failed"); +} diff --git a/src/meta/name.rs b/src/meta/name.rs index fbd4e1730..a01851a13 100644 --- a/src/meta/name.rs +++ b/src/meta/name.rs @@ -273,7 +273,7 @@ mod test { fs::create_dir(&dir_path).expect("failed to create the dir"); let meta = Meta::from_path(&dir_path, false).unwrap(); - let colors = Colors::new(color::ThemeOption::NoLscolors); + let colors = Colors::new(color::ThemeOption::Default); assert_eq!( " directory".to_string().with(Color::AnsiValue(33)),