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

Function TestBodyRemoveAttribute

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

Source from the content-addressed store, hash-verified

1037}
1038
1039func TestBodyRemoveAttribute(t *testing.T) {
1040 tests := []struct {
1041 src string
1042 name string
1043 want Tokens
1044 }{
1045 {
1046 "",
1047 "a",
1048 Tokens{
1049 {
1050 Type: hclsyntax.TokenEOF,
1051 Bytes: []byte{},
1052 SpacesBefore: 0,
1053 },
1054 },
1055 },
1056 {
1057 "b = false\n",
1058 "a",
1059 Tokens{
1060 {
1061 Type: hclsyntax.TokenIdent,
1062 Bytes: []byte{'b'},
1063 SpacesBefore: 0,
1064 },
1065 {
1066 Type: hclsyntax.TokenEqual,
1067 Bytes: []byte{'='},
1068 SpacesBefore: 1,
1069 },
1070 {
1071 Type: hclsyntax.TokenIdent,
1072 Bytes: []byte("false"),
1073 SpacesBefore: 1,
1074 },
1075 {
1076 Type: hclsyntax.TokenNewline,
1077 Bytes: []byte{'\n'},
1078 SpacesBefore: 0,
1079 },
1080 {
1081 Type: hclsyntax.TokenEOF,
1082 Bytes: []byte{},
1083 SpacesBefore: 0,
1084 },
1085 },
1086 },
1087 {
1088 "a = false\n",
1089 "a",
1090 Tokens{
1091 {
1092 Type: hclsyntax.TokenEOF,
1093 Bytes: []byte{},
1094 SpacesBefore: 0,
1095 },
1096 },

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected