mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 13:42:34 +00:00
display/tree: 🔍 ✨ add test and changelog for show edge before name
Signed-off-by: zwPapEr <zw.paper@gmail.com>
This commit is contained in:
parent
7f3d4ff9e2
commit
072a9bd756
3 changed files with 68 additions and 0 deletions
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add man page from [edneville](https://github.com/edneville)
|
||||
### Changed
|
||||
- Not showing `.` and `..` when `--tree` with `--all` from [zwpaper](https://github.com/zwpaper) [#477](https://github.com/Peltoche/lsd/issues/477)
|
||||
- Show tree edge before name block from [zwpaper](https://github.com/zwpaper) [#468](https://github.com/Peltoche/lsd/issues/468)
|
||||
### Fixed
|
||||
- Fix handling blocks passed without -l in cli from [meain](https://github.com/meain)
|
||||
- Fix sorting of . and .. when used with folder from [meain](https://github.com/meain)
|
||||
|
|
|
@ -488,4 +488,57 @@ mod tests {
|
|||
assert_eq!(get_visible_width(&output), *l);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_display_tree_with_all() {
|
||||
let argv = vec!["lsd", "--tree", "--all"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
let flags = Flags::configure_from(&matches, &Config::with_none()).unwrap();
|
||||
|
||||
let dir = assert_fs::TempDir::new().unwrap();
|
||||
dir.child("one.d").create_dir_all().unwrap();
|
||||
dir.child("one.d/two").touch().unwrap();
|
||||
dir.child("one.d/.hidden").touch().unwrap();
|
||||
let metas = Meta::from_path(Path::new(dir.path()), false)
|
||||
.unwrap()
|
||||
.recurse_into(42, &flags)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let output = inner_display_tree(
|
||||
&metas,
|
||||
&flags,
|
||||
&Colors::new(color::Theme::NoColor),
|
||||
&Icons::new(icon::Theme::NoIcon, " ".to_string()),
|
||||
0,
|
||||
"",
|
||||
);
|
||||
|
||||
assert_eq!("one.d\n├── .hidden\n└── two\n", output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_display_tree_edge_before_name() {
|
||||
let argv = vec!["lsd", "--tree", "--long"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
let flags = Flags::configure_from(&matches, &Config::with_none()).unwrap();
|
||||
|
||||
let dir = assert_fs::TempDir::new().unwrap();
|
||||
dir.child("one.d").create_dir_all().unwrap();
|
||||
dir.child("one.d/two").touch().unwrap();
|
||||
let metas = Meta::from_path(Path::new(dir.path()), false)
|
||||
.unwrap()
|
||||
.recurse_into(42, &flags)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let output = inner_display_tree(
|
||||
&metas,
|
||||
&flags,
|
||||
&Colors::new(color::Theme::NoColor),
|
||||
&Icons::new(icon::Theme::NoIcon, " ".to_string()),
|
||||
0,
|
||||
"",
|
||||
);
|
||||
|
||||
assert!(output.ends_with("└── two\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,6 +447,20 @@ fn test_tree_all_not_show_self() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tree_show_edge_before_name() {
|
||||
let tmp = tempdir();
|
||||
tmp.child("one.d").create_dir_all().unwrap();
|
||||
tmp.child("one.d/two").touch().unwrap();
|
||||
|
||||
cmd()
|
||||
.arg(tmp.path())
|
||||
.arg("--tree")
|
||||
.arg("--long")
|
||||
.assert()
|
||||
.stdout(predicate::str::is_match("└── two\n$").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tree_d() {
|
||||
let tmp = tempdir();
|
||||
|
|
Loading…
Reference in a new issue