refactor: extract map node

上级 fcefebad
......@@ -145,7 +145,7 @@ type GraphNode struct {
children []*GraphNode
}
func (fullGraph *FullGraph) ToMapDot(split string, include func(key string) bool) *GraphNode {
func (fullGraph *FullGraph) BuildMapTree(split string, include func(key string) bool) *GraphNode {
graph := gographviz.NewGraph()
_ = graph.SetName("G")
......@@ -160,6 +160,12 @@ func (fullGraph *FullGraph) ToMapDot(split string, include func(key string) bool
return graphNode
}
func (f *FullGraph) ToMapDot(node *GraphNode) {
}
func buildNode(arr []string, node *GraphNode) *GraphNode {
if node.text == arr[0] {
......
......@@ -5,8 +5,7 @@ import (
"testing"
)
func Test_VisualDemo(t *testing.T) {
g := NewGomegaWithT(t)
func createBasicMap() (*GraphNode, *FullGraph) {
fullGraph := &FullGraph{
NodeList: make(map[string]string),
RelationList: make(map[string]*Relation),
......@@ -28,7 +27,13 @@ func Test_VisualDemo(t *testing.T) {
return true
}
node := fullGraph.ToMapDot(".", nodeFilter)
node := fullGraph.BuildMapTree(".", nodeFilter)
return node, fullGraph
}
func Test_BuildGraphNode(t *testing.T) {
g := NewGomegaWithT(t)
node, _ := createBasicMap()
g.Expect(node.text).To(Equal("com"))
children := node.children
......@@ -36,3 +41,11 @@ func Test_VisualDemo(t *testing.T) {
g.Expect(children[0].text).To(Equal("phodal"))
g.Expect(children[1].text).To(Equal("spring"))
}
func Test_BuildNodeDot(t *testing.T) {
g := NewGomegaWithT(t)
node, graph := createBasicMap()
graph.ToMapDot(node)
g.Expect(true).To(Equal(true))
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册