mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 13:42:34 +00:00
Add tests for icons
This commit is contained in:
parent
3439e1d735
commit
68cd59840e
1 changed files with 64 additions and 0 deletions
|
@ -404,3 +404,67 @@ fn cmd() -> Command {
|
|||
fn tempdir() -> assert_fs::TempDir {
|
||||
assert_fs::TempDir::new().unwrap()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_lower_case_name_icon_match() {
|
||||
let dir = tempdir();
|
||||
dir.child(".trash").touch().unwrap();
|
||||
let test_file = dir.path().join(".trash");
|
||||
|
||||
cmd()
|
||||
.arg("--icon")
|
||||
.arg("always")
|
||||
.arg("--ignore-config")
|
||||
.arg(test_file)
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("\u{f1f8}"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_upper_case_name_icon_match() {
|
||||
let dir = tempdir();
|
||||
dir.child(".TRASH").touch().unwrap();
|
||||
let test_file = dir.path().join(".TRASH");
|
||||
|
||||
cmd()
|
||||
.arg("--icon")
|
||||
.arg("always")
|
||||
.arg("--ignore-config")
|
||||
.arg(test_file)
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("\u{f1f8}"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_lower_case_ext_icon_match() {
|
||||
let dir = tempdir();
|
||||
dir.child("test.7z").touch().unwrap();
|
||||
let test_file = dir.path().join("test.7z");
|
||||
|
||||
cmd()
|
||||
.arg("--icon")
|
||||
.arg("always")
|
||||
.arg("--ignore-config")
|
||||
.arg(test_file)
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("\u{f410}"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_upper_case_ext_icon_match() {
|
||||
let dir = tempdir();
|
||||
dir.child("test.7Z").touch().unwrap();
|
||||
let test_file = dir.path().join("test.7Z");
|
||||
|
||||
cmd()
|
||||
.arg("--icon")
|
||||
.arg("always")
|
||||
.arg("--ignore-config")
|
||||
.arg(test_file)
|
||||
.assert()
|
||||
.stdout(predicate::str::contains("\u{f410}"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue