Skip to content

Commit

Permalink
Add test case for label completion
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Nov 25, 2022
1 parent 6addab3 commit de10f10
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions decoder/body_extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,50 @@ resource "aws_elastic_beanstalk_environment" "example" {
},
}),
},
{
"dynamic block label never completes static blocks",
&schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"resource": {
Labels: []*schema.LabelSchema{
{
Name: "type",
IsDepKey: true,
Completable: true,
},
{Name: "name"},
},
Body: &schema.BodySchema{
Extensions: &schema.BodyExtensions{
DynamicBlocks: true,
},
Blocks: map[string]*schema.BlockSchema{
"lifecycle": {
Body: schema.NewBodySchema(),
},
},
},
DependentBody: map[schema.SchemaKey]*schema.BodySchema{
schema.NewSchemaKey(schema.DependencyKeys{
Labels: []schema.LabelDependent{
{Index: 0, Value: "aws_instance"},
},
}): {
Blocks: make(map[string]*schema.BlockSchema, 0),
},
},
},
},
},
`resource "aws_instance" "example" {
name = "example"
dynamic "" {
}
}`,
hcl.Pos{Line: 3, Column: 12, Byte: 66},
lang.CompleteCandidates([]lang.Candidate{}),
},
// completion nesting should work
{
"dynamic block completion nesting should work",
Expand Down

0 comments on commit de10f10

Please sign in to comment.