Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpogran committed Mar 22, 2023
1 parent e692bb6 commit 1f0b924
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions decoder/expr_type_declaration_completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ func TestCompletionAtPos_exprTypeDeclaration(t *testing.T) {
},
}),
},
{
"tuple inside brackets single-line",
map[string]*schema.AttributeSchema{
"attr": {
Constraint: schema.TypeDeclaration{},
},
},
`attr = tuple([ ])
`,
hcl.Pos{Line: 1, Column: 15, Byte: 14},
lang.CompleteCandidates(allTypeDeclarationsAsCandidates("", hcl.Range{
Filename: "test.tf",
Start: hcl.Pos{Line: 1, Column: 15, Byte: 14},
End: hcl.Pos{Line: 1, Column: 15, Byte: 14},
})),
},
{
"inside tuple - second type after comma",
map[string]*schema.AttributeSchema{
Expand Down Expand Up @@ -341,6 +357,42 @@ func TestCompletionAtPos_exprTypeDeclaration(t *testing.T) {
},
}),
},
{
"missing object notation single-line new element inside quoted key name with no equal sign",
map[string]*schema.AttributeSchema{
"attr": {
Constraint: schema.TypeDeclaration{},
},
},
`attr = { "foo" }
`,
hcl.Pos{Line: 1, Column: 12, Byte: 11},
lang.CompleteCandidates([]lang.Candidate{}),
},
{
"missing object notation single-line new element inside key name with no equal sign",
map[string]*schema.AttributeSchema{
"attr": {
Constraint: schema.TypeDeclaration{},
},
},
`attr = { foo }
`,
hcl.Pos{Line: 1, Column: 11, Byte: 10},
lang.CompleteCandidates([]lang.Candidate{}),
},
{
"missing object notation single-line new element value after equal sign",
map[string]*schema.AttributeSchema{
"attr": {
Constraint: schema.TypeDeclaration{},
},
},
`attr = { foo = }
`,
hcl.Pos{Line: 1, Column: 16, Byte: 15},
lang.CompleteCandidates([]lang.Candidate{}),
},
{
"single-line object value",
map[string]*schema.AttributeSchema{
Expand Down

0 comments on commit 1f0b924

Please sign in to comment.