mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 02:03:24 +08:00
wip
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user