Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increasing code coverage issue #46 #862

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/git_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
11 changes: 11 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
2 changes: 1 addition & 1 deletion src/meta/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down