gohcl: rename struct tag prefix from "zcl:" to "hcl:"
This commit is contained in:
parent
b8b5e0be6d
commit
bdf1e7c6e6
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/hashicorp/hcl2/gohcl"
|
"github.com/hashicorp/hcl2/gohcl"
|
||||||
"github.com/hashicorp/hcl2/hcltest"
|
|
||||||
"github.com/hashicorp/hcl2/hcl"
|
"github.com/hashicorp/hcl2/hcl"
|
||||||
|
"github.com/hashicorp/hcl2/hcltest"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,10 +78,10 @@ func TestTransformer(t *testing.T) {
|
|||||||
merged := transformer.TransformBody(caller)
|
merged := transformer.TransformBody(caller)
|
||||||
|
|
||||||
type foo struct {
|
type foo struct {
|
||||||
From string `zcl:"from,attr"`
|
From string `hcl:"from,attr"`
|
||||||
}
|
}
|
||||||
type result struct {
|
type result struct {
|
||||||
Foos []foo `zcl:"foo,block"`
|
Foos []foo `hcl:"foo,block"`
|
||||||
}
|
}
|
||||||
var got result
|
var got result
|
||||||
diags := gohcl.DecodeBody(merged, nil, &got)
|
diags := gohcl.DecodeBody(merged, nil, &got)
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
zclJSON "github.com/hashicorp/hcl2/hcl/json"
|
|
||||||
"github.com/hashicorp/hcl2/hcl"
|
"github.com/hashicorp/hcl2/hcl"
|
||||||
|
zclJSON "github.com/hashicorp/hcl2/hcl/json"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,20 +34,20 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
{
|
{
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{},
|
}{},
|
||||||
deepEquals(struct {
|
deepEquals(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{}),
|
}{}),
|
||||||
1, // name is required
|
1, // name is required
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
struct {
|
struct {
|
||||||
Name *string `zcl:"name"`
|
Name *string `hcl:"name"`
|
||||||
}{},
|
}{},
|
||||||
deepEquals(struct {
|
deepEquals(struct {
|
||||||
Name *string `zcl:"name"`
|
Name *string `hcl:"name"`
|
||||||
}{}),
|
}{}),
|
||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
@ -56,10 +56,10 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"name": "Ermintrude",
|
"name": "Ermintrude",
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{},
|
}{},
|
||||||
deepEquals(struct {
|
deepEquals(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{"Ermintrude"}),
|
}{"Ermintrude"}),
|
||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
@ -69,10 +69,10 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"age": 23,
|
"age": 23,
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{},
|
}{},
|
||||||
deepEquals(struct {
|
deepEquals(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
}{"Ermintrude"}),
|
}{"Ermintrude"}),
|
||||||
1, // Extraneous "age" property
|
1, // Extraneous "age" property
|
||||||
},
|
},
|
||||||
@ -82,13 +82,13 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"age": 50,
|
"age": 50,
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Attrs hcl.Attributes `zcl:",remain"`
|
Attrs hcl.Attributes `hcl:",remain"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
got := gotI.(struct {
|
got := gotI.(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Attrs hcl.Attributes `zcl:",remain"`
|
Attrs hcl.Attributes `hcl:",remain"`
|
||||||
})
|
})
|
||||||
return got.Name == "Ermintrude" && len(got.Attrs) == 1 && got.Attrs["age"] != nil
|
return got.Name == "Ermintrude" && len(got.Attrs) == 1 && got.Attrs["age"] != nil
|
||||||
},
|
},
|
||||||
@ -100,13 +100,13 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"age": 50,
|
"age": 50,
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Remain hcl.Body `zcl:",remain"`
|
Remain hcl.Body `hcl:",remain"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
got := gotI.(struct {
|
got := gotI.(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Remain hcl.Body `zcl:",remain"`
|
Remain hcl.Body `hcl:",remain"`
|
||||||
})
|
})
|
||||||
|
|
||||||
attrs, _ := got.Remain.JustAttributes()
|
attrs, _ := got.Remain.JustAttributes()
|
||||||
@ -121,12 +121,12 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"age": 51,
|
"age": 51,
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Remain map[string]cty.Value `zcl:",remain"`
|
Remain map[string]cty.Value `hcl:",remain"`
|
||||||
}{},
|
}{},
|
||||||
deepEquals(struct {
|
deepEquals(struct {
|
||||||
Name string `zcl:"name"`
|
Name string `hcl:"name"`
|
||||||
Remain map[string]cty.Value `zcl:",remain"`
|
Remain map[string]cty.Value `hcl:",remain"`
|
||||||
}{
|
}{
|
||||||
Name: "Ermintrude",
|
Name: "Ermintrude",
|
||||||
Remain: map[string]cty.Value{
|
Remain: map[string]cty.Value{
|
||||||
@ -140,7 +140,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": map[string]interface{}{},
|
"noodle": map[string]interface{}{},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct{} `zcl:"noodle,block"`
|
Noodle struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating no diagnostics is good enough for this one.
|
// Generating no diagnostics is good enough for this one.
|
||||||
@ -153,7 +153,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}},
|
"noodle": []map[string]interface{}{{}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct{} `zcl:"noodle,block"`
|
Noodle struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating no diagnostics is good enough for this one.
|
// Generating no diagnostics is good enough for this one.
|
||||||
@ -166,7 +166,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}, {}},
|
"noodle": []map[string]interface{}{{}, {}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct{} `zcl:"noodle,block"`
|
Noodle struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating one diagnostic is good enough for this one.
|
// Generating one diagnostic is good enough for this one.
|
||||||
@ -177,7 +177,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
{
|
{
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct{} `zcl:"noodle,block"`
|
Noodle struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating one diagnostic is good enough for this one.
|
// Generating one diagnostic is good enough for this one.
|
||||||
@ -190,7 +190,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{},
|
"noodle": []map[string]interface{}{},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct{} `zcl:"noodle,block"`
|
Noodle struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating one diagnostic is good enough for this one.
|
// Generating one diagnostic is good enough for this one.
|
||||||
@ -203,11 +203,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": map[string]interface{}{},
|
"noodle": map[string]interface{}{},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
return gotI.(struct {
|
return gotI.(struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle != nil
|
}).Noodle != nil
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
@ -217,11 +217,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}},
|
"noodle": []map[string]interface{}{{}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
return gotI.(struct {
|
return gotI.(struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle != nil
|
}).Noodle != nil
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
@ -231,11 +231,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{},
|
"noodle": []map[string]interface{}{},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
return gotI.(struct {
|
return gotI.(struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle == nil
|
}).Noodle == nil
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
@ -245,7 +245,7 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}, {}},
|
"noodle": []map[string]interface{}{{}, {}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle *struct{} `zcl:"noodle,block"`
|
Noodle *struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating one diagnostic is good enough for this one.
|
// Generating one diagnostic is good enough for this one.
|
||||||
@ -258,11 +258,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{},
|
"noodle": []map[string]interface{}{},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodle := gotI.(struct {
|
noodle := gotI.(struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle
|
}).Noodle
|
||||||
return len(noodle) == 0
|
return len(noodle) == 0
|
||||||
},
|
},
|
||||||
@ -273,11 +273,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}},
|
"noodle": []map[string]interface{}{{}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodle := gotI.(struct {
|
noodle := gotI.(struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle
|
}).Noodle
|
||||||
return len(noodle) == 1
|
return len(noodle) == 1
|
||||||
},
|
},
|
||||||
@ -288,11 +288,11 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
"noodle": []map[string]interface{}{{}, {}},
|
"noodle": []map[string]interface{}{{}, {}},
|
||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodle := gotI.(struct {
|
noodle := gotI.(struct {
|
||||||
Noodle []struct{} `zcl:"noodle,block"`
|
Noodle []struct{} `hcl:"noodle,block"`
|
||||||
}).Noodle
|
}).Noodle
|
||||||
return len(noodle) == 2
|
return len(noodle) == 2
|
||||||
},
|
},
|
||||||
@ -304,8 +304,8 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// Generating two diagnostics is good enough for this one.
|
// Generating two diagnostics is good enough for this one.
|
||||||
@ -324,14 +324,14 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodle := gotI.(struct {
|
noodle := gotI.(struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}).Noodle
|
}).Noodle
|
||||||
return noodle.Name == "foo_foo"
|
return noodle.Name == "foo_foo"
|
||||||
},
|
},
|
||||||
@ -346,8 +346,8 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
// One diagnostic is enough for this one.
|
// One diagnostic is enough for this one.
|
||||||
@ -364,14 +364,14 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodles []struct {
|
Noodles []struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodles := gotI.(struct {
|
noodles := gotI.(struct {
|
||||||
Noodles []struct {
|
Noodles []struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}).Noodles
|
}).Noodles
|
||||||
return len(noodles) == 2 && (noodles[0].Name == "foo_foo" || noodles[0].Name == "bar_baz") && (noodles[1].Name == "foo_foo" || noodles[1].Name == "bar_baz") && noodles[0].Name != noodles[1].Name
|
return len(noodles) == 2 && (noodles[0].Name == "foo_foo" || noodles[0].Name == "bar_baz") && (noodles[1].Name == "foo_foo" || noodles[1].Name == "bar_baz") && noodles[0].Name != noodles[1].Name
|
||||||
},
|
},
|
||||||
@ -387,16 +387,16 @@ func TestDecodeBody(t *testing.T) {
|
|||||||
},
|
},
|
||||||
struct {
|
struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
Type string `zcl:"type"`
|
Type string `hcl:"type"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}{},
|
}{},
|
||||||
func(gotI interface{}) bool {
|
func(gotI interface{}) bool {
|
||||||
noodle := gotI.(struct {
|
noodle := gotI.(struct {
|
||||||
Noodle struct {
|
Noodle struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
Type string `zcl:"type"`
|
Type string `hcl:"type"`
|
||||||
} `zcl:"noodle,block"`
|
} `hcl:"noodle,block"`
|
||||||
}).Noodle
|
}).Noodle
|
||||||
return noodle.Name == "foo_foo" && noodle.Type == "rice"
|
return noodle.Name == "foo_foo" && noodle.Type == "rice"
|
||||||
},
|
},
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// A struct field tag scheme is used, similar to other decoding and
|
// A struct field tag scheme is used, similar to other decoding and
|
||||||
// unmarshalling libraries. The tags are formatted as in the following example:
|
// unmarshalling libraries. The tags are formatted as in the following example:
|
||||||
//
|
//
|
||||||
// ThingType string `zcl:"thing_type,attr"`
|
// ThingType string `hcl:"thing_type,attr"`
|
||||||
//
|
//
|
||||||
// Within each tag there are two comma-separated tokens. The first is the
|
// Within each tag there are two comma-separated tokens. The first is the
|
||||||
// name of the corresponding construct in configuration, while the second
|
// name of the corresponding construct in configuration, while the second
|
||||||
|
@ -66,7 +66,7 @@ func ImpliedBodySchema(val interface{}) (schema *hcl.BodySchema, partial bool) {
|
|||||||
}
|
}
|
||||||
if fty.Kind() != reflect.Struct {
|
if fty.Kind() != reflect.Struct {
|
||||||
panic(fmt.Sprintf(
|
panic(fmt.Sprintf(
|
||||||
"zcl 'block' tag kind cannot be applied to %s field %s: struct required", field.Type.String(), field.Name,
|
"hcl 'block' tag kind cannot be applied to %s field %s: struct required", field.Type.String(), field.Name,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
ftags := getFieldTags(fty)
|
ftags := getFieldTags(fty)
|
||||||
@ -113,7 +113,7 @@ func getFieldTags(ty reflect.Type) *fieldTags {
|
|||||||
ct := ty.NumField()
|
ct := ty.NumField()
|
||||||
for i := 0; i < ct; i++ {
|
for i := 0; i < ct; i++ {
|
||||||
field := ty.Field(i)
|
field := ty.Field(i)
|
||||||
tag := field.Tag.Get("zcl")
|
tag := field.Tag.Get("hcl")
|
||||||
if tag == "" {
|
if tag == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ func getFieldTags(ty reflect.Type) *fieldTags {
|
|||||||
idx := i // copy, because this loop will continue assigning to i
|
idx := i // copy, because this loop will continue assigning to i
|
||||||
ret.Remain = &idx
|
ret.Remain = &idx
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid zcl field tag kind %q on %s %q", kind, field.Type.String(), field.Name))
|
panic(fmt.Sprintf("invalid hcl field tag kind %q on %s %q", kind, field.Type.String(), field.Name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Attr1 bool `zcl:"attr1"`
|
Attr1 bool `hcl:"attr1"`
|
||||||
Attr2 bool `zcl:"attr2"`
|
Attr2 bool `hcl:"attr2"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Attributes: []hcl.AttributeSchema{
|
Attributes: []hcl.AttributeSchema{
|
||||||
@ -48,7 +48,7 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Attr *bool `zcl:"attr,attr"`
|
Attr *bool `hcl:"attr,attr"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Attributes: []hcl.AttributeSchema{
|
Attributes: []hcl.AttributeSchema{
|
||||||
@ -62,7 +62,7 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Thing struct{} `zcl:"thing,block"`
|
Thing struct{} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Blocks: []hcl.BlockHeaderSchema{
|
Blocks: []hcl.BlockHeaderSchema{
|
||||||
@ -76,9 +76,9 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Thing struct {
|
Thing struct {
|
||||||
Type string `zcl:"type,label"`
|
Type string `hcl:"type,label"`
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"thing,block"`
|
} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Blocks: []hcl.BlockHeaderSchema{
|
Blocks: []hcl.BlockHeaderSchema{
|
||||||
@ -93,9 +93,9 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Thing []struct {
|
Thing []struct {
|
||||||
Type string `zcl:"type,label"`
|
Type string `hcl:"type,label"`
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"thing,block"`
|
} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Blocks: []hcl.BlockHeaderSchema{
|
Blocks: []hcl.BlockHeaderSchema{
|
||||||
@ -110,9 +110,9 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Thing *struct {
|
Thing *struct {
|
||||||
Type string `zcl:"type,label"`
|
Type string `hcl:"type,label"`
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"thing,block"`
|
} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Blocks: []hcl.BlockHeaderSchema{
|
Blocks: []hcl.BlockHeaderSchema{
|
||||||
@ -127,9 +127,9 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Thing struct {
|
Thing struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
Something string `zcl:"something"`
|
Something string `hcl:"something"`
|
||||||
} `zcl:"thing,block"`
|
} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Blocks: []hcl.BlockHeaderSchema{
|
Blocks: []hcl.BlockHeaderSchema{
|
||||||
@ -143,10 +143,10 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Doodad string `zcl:"doodad"`
|
Doodad string `hcl:"doodad"`
|
||||||
Thing struct {
|
Thing struct {
|
||||||
Name string `zcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
} `zcl:"thing,block"`
|
} `hcl:"thing,block"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Attributes: []hcl.AttributeSchema{
|
Attributes: []hcl.AttributeSchema{
|
||||||
@ -166,8 +166,8 @@ func TestImpliedBodySchema(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
Doodad string `zcl:"doodad"`
|
Doodad string `hcl:"doodad"`
|
||||||
Config string `zcl:",remain"`
|
Config string `hcl:",remain"`
|
||||||
}{},
|
}{},
|
||||||
&hcl.BodySchema{
|
&hcl.BodySchema{
|
||||||
Attributes: []hcl.AttributeSchema{
|
Attributes: []hcl.AttributeSchema{
|
||||||
|
Loading…
Reference in New Issue
Block a user