blob: 4d60cf124c4f9f1744c52570c39cf2fa70d197eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
use super::*;
#[test]
fn render_tree_root() {
let tree = Tree::new("foo");
assert_eq!(format!("{}", tree), "foo\n")
}
#[test]
fn render_tree_with_leaves() {
let tree = Tree::new("foo").with_leaves([Tree::new("bar").with_leaves(["baz"])]);
assert_eq!(
format!("{}", tree),
r#"foo
└── bar
└── baz
"#
)
}
#[test]
fn render_tree_with_multiple_leaves() {
let tree = Tree::new("foo").with_leaves(["bar", "baz"]);
assert_eq!(
format!("{}", tree),
r#"foo
├── bar
└── baz
"#
)
}
#[test]
fn render_tree_with_multiline_leaf() {
let tree = Tree::new("foo").with_leaves([
Tree::new("hello\nworld").with_multiline(true),
Tree::new("goodbye\nworld").with_multiline(true),
]);
assert_eq!(
format!("{}", tree),
r#"foo
├── hello
│ world
└── goodbye
world
"#
)
}
|