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