mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-21 19:48:12 +00:00
43 lines
799 B
Go
43 lines
799 B
Go
package gographviz
|
|
|
|
import (
|
|
"github.com/awalterschulze/gographviz/ast"
|
|
"github.com/awalterschulze/gographviz/parser"
|
|
"testing"
|
|
)
|
|
|
|
type bugSubGraphWorldVisitor struct {
|
|
t *testing.T
|
|
found bool
|
|
}
|
|
|
|
func (this *bugSubGraphWorldVisitor) Visit(v ast.Elem) ast.Visitor {
|
|
edge, ok := v.(ast.EdgeStmt)
|
|
if !ok {
|
|
return this
|
|
}
|
|
if edge.Source.GetId().String() != "2" {
|
|
return this
|
|
}
|
|
dst := edge.EdgeRHS[0].Destination
|
|
if _, ok := dst.(*ast.SubGraph); !ok {
|
|
this.t.Fatalf("2 -> Not SubGraph")
|
|
} else {
|
|
this.found = true
|
|
}
|
|
return this
|
|
}
|
|
|
|
func TestBugSubGraphWorld(t *testing.T) {
|
|
g := analtest(t, "world.gv.txt")
|
|
st, err := parser.ParseString(g.String())
|
|
check(t, err)
|
|
s := &bugSubGraphWorldVisitor{
|
|
t: t,
|
|
}
|
|
st.Walk(s)
|
|
if !s.found {
|
|
t.Fatalf("2 -> SubGraph not found")
|
|
}
|
|
}
|