mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
70eebe3521
This is part of a general effort to move all of Terraform's non-library package surface under internal in order to reinforce that these are for internal use within Terraform only. If you were previously importing packages under this prefix into an external codebase, you could pin to an earlier release tag as an interim solution until you've make a plan to achieve the same functionality some other way.
40 lines
685 B
Go
40 lines
685 B
Go
package dag
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestGraphDot_opts(t *testing.T) {
|
|
var v testDotVertex
|
|
var g Graph
|
|
g.Add(&v)
|
|
|
|
opts := &DotOpts{MaxDepth: 42}
|
|
actual := g.Dot(opts)
|
|
if len(actual) == 0 {
|
|
t.Fatal("should not be empty")
|
|
}
|
|
|
|
if !v.DotNodeCalled {
|
|
t.Fatal("should call DotNode")
|
|
}
|
|
if !reflect.DeepEqual(v.DotNodeOpts, opts) {
|
|
t.Fatalf("bad; %#v", v.DotNodeOpts)
|
|
}
|
|
}
|
|
|
|
type testDotVertex struct {
|
|
DotNodeCalled bool
|
|
DotNodeTitle string
|
|
DotNodeOpts *DotOpts
|
|
DotNodeReturn *DotNode
|
|
}
|
|
|
|
func (v *testDotVertex) DotNode(title string, opts *DotOpts) *DotNode {
|
|
v.DotNodeCalled = true
|
|
v.DotNodeTitle = title
|
|
v.DotNodeOpts = opts
|
|
return v.DotNodeReturn
|
|
}
|