yq/pkg/yqlib/hcl_test.go
2025-12-07 09:38:10 +11:00

29 lines
619 B
Go

package yqlib
import (
"testing"
"github.com/mikefarah/yq/v4/test"
)
var hclFormatScenarios = []formatScenario{
{
description: "Simple decode",
input: `io_mode = "async"`,
expected: "io_mode: async\n",
scenarioType: "decode",
},
}
func testHclScenario(t *testing.T, s formatScenario) {
if s.scenarioType == "decode" {
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewHclDecoder(), NewYamlEncoder(ConfiguredYamlPreferences)), s.description)
}
}
func TestHclFormatScenarios(t *testing.T) {
for _, tt := range hclFormatScenarios {
testHclScenario(t, tt)
}
}