mirror of
https://github.com/orhun/systeroid
synced 2024-07-21 10:25:00 +00:00
test(tree): add output test for tree format
This commit is contained in:
parent
251327519b
commit
5a729d8acb
|
@ -221,9 +221,28 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_print_line() {
|
||||
let value = String::from("abc\ndef");
|
||||
fn test_tree_output() {
|
||||
env::set_var("NO_COLOR", "1");
|
||||
let lines = ["a", "a/b/e", "a/b", "a/b/c/d"];
|
||||
|
||||
let tree = Tree::from_input(&mut lines.iter(), '/');
|
||||
let mut output = Vec::new();
|
||||
tree.print(&mut output, Color::White).unwrap();
|
||||
|
||||
let expected_output = "\
|
||||
a
|
||||
└── b
|
||||
├── e
|
||||
└── c
|
||||
└── d\n";
|
||||
|
||||
assert_eq!(expected_output, String::from_utf8_lossy(&output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_print_line() {
|
||||
env::set_var("NO_COLOR", "1");
|
||||
let value = String::from("abc\ndef");
|
||||
|
||||
let mut output = Vec::new();
|
||||
TreeNode {
|
||||
|
|
Loading…
Reference in a new issue