pulumi/pkg/codegen/hcl2/model/print_test.go

27 lines
450 B
Go
Raw Normal View History

package model
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/zclconf/go-cty/cty"
)
func TestPrintNoTokens(t *testing.T) {
b := &Block{
Type: "block", Body: &Body{
Items: []BodyItem{
&Attribute{
Name: "attribute",
Value: &LiteralValueExpression{
Value: cty.True,
},
},
},
},
}
expected := "block {\n attribute = true\n}"
assert.Equal(t, expected, fmt.Sprintf("%v", b))
}