This commit is contained in:
Mike Farah
2025-12-08 20:30:47 +11:00
parent 9e17cd683f
commit 69076dfe81
3 changed files with 54 additions and 7 deletions
+36
View File
@@ -13,6 +13,42 @@ var hclFormatScenarios = []formatScenario{
expected: "io_mode: async\n",
scenarioType: "decode",
},
{
description: "number attribute",
input: `port = 8080`,
expected: "port: 8080\n",
scenarioType: "decode",
},
{
description: "float attribute",
input: `pi = 3.14`,
expected: "pi: 3.14\n",
scenarioType: "decode",
},
{
description: "boolean attribute",
input: `enabled = true`,
expected: "enabled: true\n",
scenarioType: "decode",
},
{
description: "list of strings",
input: `tags = ["a", "b"]`,
expected: "tags: ' [\"a\", \"b\"]'\n",
scenarioType: "decode",
},
{
description: "object/map attribute",
input: `obj = { a = 1, b = "two" }`,
expected: "obj: ' { a = 1, b = \"two\" }'\n",
scenarioType: "decode",
},
{
description: "nested block",
input: `server { port = 8080 }`,
expected: "server:\n port: 8080\n",
scenarioType: "decode",
},
}
func testHclScenario(t *testing.T, s formatScenario) {