another test case in helper/plugin
This commit is contained in:
parent
eddf676c1f
commit
e95f2b586e
|
@ -847,7 +847,7 @@ func pathToAttributePath(path cty.Path) *proto.AttributePath {
|
|||
// normalizeFlatmapContainers removes empty containers, and fixes counts in a
|
||||
// set of flatmapped attributes.
|
||||
func normalizeFlatmapContainers(attrs map[string]string) map[string]string {
|
||||
keyRx := regexp.MustCompile(`.*\.[%#]$`)
|
||||
keyRx := regexp.MustCompile(`.\.[%#]$`)
|
||||
|
||||
// find container keys
|
||||
var keys []string
|
||||
|
|
|
@ -661,6 +661,10 @@ func TestNormalizeFlatmapContainers(t *testing.T) {
|
|||
attrs: map[string]string{"multi.529860700.set.#": "1", "multi.#": "1", "id": "78629a0f5f3f164f"},
|
||||
expect: map[string]string{"id": "78629a0f5f3f164f"},
|
||||
},
|
||||
{
|
||||
attrs: map[string]string{"set.2.required": "bar", "set.2.list.#": "1", "set.2.list.0": "x", "set.1.list.#": "0"},
|
||||
expect: map[string]string{"set.2.list.#": "1", "set.2.list.0": "x", "set.2.required": "bar", "set.#": "1"},
|
||||
},
|
||||
} {
|
||||
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
||||
got := normalizeFlatmapContainers(tc.attrs)
|
||||
|
|
Loading…
Reference in New Issue