Skip to content

Commit

Permalink
Add test for missing hover on count expression
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Nov 28, 2022
1 parent 6fddd36 commit ccf69a8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions decoder/hover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,64 @@ variable "name" {
},
},
},
{
"count var reference",
&schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"myblock": {
Labels: []*schema.LabelSchema{
{Name: "type", IsDepKey: true},
{Name: "name"},
},
Body: &schema.BodySchema{
Extensions: &schema.BodyExtensions{
Count: true,
},
Attributes: map[string]*schema.AttributeSchema{
"foo": {
IsOptional: true,
Expr: schema.ExprConstraints{
schema.TraversalExpr{
OfType: cty.Number,
},
},
},
},
},
},
"variable": {
Labels: []*schema.LabelSchema{
{Name: "name"},
},
Body: &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"type": {
Expr: schema.ExprConstraints{schema.TypeDeclarationExpr{}},
IsOptional: true,
},
},
},
},
},
},
`myblock "foo" "bar" {
foo = count.index
count = var.name
}
variable "name" {
value = 4
}
`,
hcl.Pos{Line: 3, Column: 16, Byte: 57},
&lang.HoverData{
Content: lang.Markdown("text"),
Range: hcl.Range{
Filename: "test.tf",
Start: hcl.Pos{Line: 3, Column: 11, Byte: 52},
End: hcl.Pos{Line: 3, Column: 19, Byte: 60},
},
},
},
}

for i, tc := range testCases {
Expand Down

0 comments on commit ccf69a8

Please sign in to comment.