2d530e8038
In general, each item in an HCL2 body must be followed by a trailing newline. The printer did not properly insert these newlines for body items without any associated tokens/trivia, or with trivia that did not include a trailing new line. Related to #1635.
26 lines
450 B
Go
26 lines
450 B
Go
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))
|
|
}
|