test...
This commit is contained in:
parent
a53fc302ee
commit
c1e0506515
2
go.mod
2
go.mod
@ -1,3 +1,5 @@
|
|||||||
module gitlab.com/tyrelsouza/cp437tree
|
module gitlab.com/tyrelsouza/cp437tree
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
require github.com/stretchr/testify v1.7.0
|
||||||
|
11
go.sum
Normal file
11
go.sum
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
26
main.go
26
main.go
@ -7,6 +7,7 @@ const (
|
|||||||
DownRight = "┌"
|
DownRight = "┌"
|
||||||
Horizontal = "─"
|
Horizontal = "─"
|
||||||
Vertical = "│"
|
Vertical = "│"
|
||||||
|
Solo = "╶"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Tree struct {
|
type Tree struct {
|
||||||
@ -14,17 +15,30 @@ type Tree struct {
|
|||||||
Children []Tree
|
Children []Tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TreeMeta struct {
|
||||||
|
Tree Tree
|
||||||
|
Depth int
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Tree) String() string {
|
func (t *Tree) String() string {
|
||||||
return t.Text
|
return t.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Tree)Walk() *TreeMeta {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
┌┐ // HeaderTop
|
┌┐ // HeaderTop // if not only item, otherwise just Solo
|
||||||
├┐ // HeaderMid
|
├┐ // HeaderMid //check depth
|
||||||
│├ // ItemMid
|
│├ // ItemMid // check depth
|
||||||
│└ // ItemBottom
|
│└ // ItemBottom //check depth
|
||||||
└┐ // HeaderBottom
|
|
||||||
└── //ItemEndBottom
|
└┐ // HeaderBottom // HARD
|
||||||
|
└── //ItemEndBottom // HARD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2,6 +2,8 @@ package cp437tree
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -68,5 +70,7 @@ func Test_Main(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Error(tree)
|
assert.Equal(t, tree.Text, "1")
|
||||||
|
assert.Equal(t, tree.Children[0].Text, "2")
|
||||||
|
assert.Equal(t, tree.Children[2].Children[0].Children[0].Children[0].Children[0].Children[0].Text, "15")
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user