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

Function TestBodyRenameAttribute

hclwrite/ast_body_test.go:1152–1314  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1150}
1151
1152func TestBodyRenameAttribute(t *testing.T) {
1153 tests := []struct {
1154 src string
1155 oldName string
1156 newName string
1157 want Tokens
1158 }{
1159 {
1160 "",
1161 "a",
1162 "b",
1163 Tokens{
1164 {
1165 Type: hclsyntax.TokenEOF,
1166 Bytes: []byte{},
1167 SpacesBefore: 0,
1168 },
1169 },
1170 },
1171 {
1172 "a = false\n",
1173 "a",
1174 "b",
1175 Tokens{
1176 {
1177 Type: hclsyntax.TokenIdent,
1178 Bytes: []byte{'b'},
1179 SpacesBefore: 0,
1180 },
1181 {
1182 Type: hclsyntax.TokenEqual,
1183 Bytes: []byte{'='},
1184 SpacesBefore: 1,
1185 },
1186 {
1187 Type: hclsyntax.TokenIdent,
1188 Bytes: []byte("false"),
1189 SpacesBefore: 1,
1190 },
1191 {
1192 Type: hclsyntax.TokenNewline,
1193 Bytes: []byte{'\n'},
1194 SpacesBefore: 0,
1195 },
1196 {
1197 Type: hclsyntax.TokenEOF,
1198 Bytes: []byte{},
1199 SpacesBefore: 0,
1200 },
1201 },
1202 },
1203 {
1204 "a = false\n",
1205 "b",
1206 "c",
1207 Tokens{
1208 {
1209 Type: hclsyntax.TokenIdent,

Callers

nothing calls this directly

Calls 8

formatFunction · 0.85
RunMethod · 0.80
GetAttributeMethod · 0.80
RenameAttributeMethod · 0.80
ParseConfigFunction · 0.70
BuildTokensMethod · 0.65
ErrorMethod · 0.45
BodyMethod · 0.45

Tested by

no test coverage detected