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

29 lines
465 B
Go

package model
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/zclconf/go-cty/cty"
)
func TestPrintNoTokens(t *testing.T) {
t.Parallel()
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))
}