Skip to content

Commit

Permalink
test: rounded enumerator test
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Apr 18, 2024
1 parent 3a498da commit 2889c21
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tree/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,39 @@ func TestTree(t *testing.T) {
require.Equal(t, expected, tree.String())
}

func TestTreeRounded(t *testing.T) {
tree := tree.New().
Items(
"Foo",
tree.New().
Root("Bar").
Items(
"Qux",
tree.New().
Root("Quux").
Items(
"Foo",
"Bar",
),
"Quuux",
),
"Baz",
).
Enumerator(tree.RoundedEnumerator)

expected := `
β”œβ”€β”€ Foo
β”œβ”€β”€ Bar
β”‚ β”œβ”€β”€ Qux
β”‚ β”œβ”€β”€ Quux
β”‚ β”‚ β”œβ”€β”€ Foo
β”‚ β”‚ ╰── Bar
β”‚ ╰── Quuux
╰── Baz
`
require.Equal(t, expected, tree.String())
}

func TestTreeHidden(t *testing.T) {
tree := tree.New().
Items(
Expand Down

0 comments on commit 2889c21

Please sign in to comment.