MCPcopy
hub / github.com/hashicorp/hcl / TestBlockLabels

Function TestBlockLabels

hclwrite/ast_block_test.go:52–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestBlockLabels(t *testing.T) {
53 tests := []struct {
54 src string
55 want []string
56 }{
57 {
58 `
59nolabel {
60}
61`,
62 []string{},
63 },
64 {
65 `
66quoted "label1" {
67}
68`,
69 []string{"label1"},
70 },
71 {
72 `
73quoted "label1" "label2" {
74}
75`,
76 []string{"label1", "label2"},
77 },
78 {
79 `
80quoted "label1" /* foo */ "label2" {
81}
82`,
83 []string{"label1", "label2"},
84 },
85 {
86 `
87unquoted label1 {
88}
89`,
90 []string{"label1"},
91 },
92 {
93 `
94unquoted label1 /* foo */ label2 {
95}
96`,
97 []string{"label1", "label2"},
98 },
99 {
100 `
101mixed label1 "label2" {
102}
103`,
104 []string{"label1", "label2"},
105 },
106 {
107 `
108escape "\u0041" {
109}

Callers

nothing calls this directly

Calls 7

RunMethod · 0.80
JoinMethod · 0.80
BlocksMethod · 0.80
LabelsMethod · 0.80
ParseConfigFunction · 0.70
ErrorMethod · 0.45
BodyMethod · 0.45

Tested by

no test coverage detected