Skip to content

Commit

Permalink
Pass context in all existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Jul 27, 2022
1 parent 3e0c438 commit ace4b0c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 29 deletions.
13 changes: 9 additions & 4 deletions decoder/body_candidates_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package decoder

import (
"context"
"testing"

"github.com/google/go-cmp/cmp"
Expand All @@ -12,6 +13,7 @@ import (
)

func TestDecoder_CandidateAtPos_incompleteAttributes(t *testing.T) {
ctx := context.Background()
bodySchema := &schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"customblock": {
Expand Down Expand Up @@ -43,7 +45,7 @@ func TestDecoder_CandidateAtPos_incompleteAttributes(t *testing.T) {
})
d.maxCandidates = 1

candidates, err := d.CandidatesAtPos("test.tf", hcl.Pos{
candidates, err := d.CandidatesAtPos(ctx, "test.tf", hcl.Pos{
Line: 2,
Column: 7,
Byte: 29,
Expand Down Expand Up @@ -84,6 +86,7 @@ func TestDecoder_CandidateAtPos_incompleteAttributes(t *testing.T) {
}

func TestDecoder_CandidateAtPos_computedAttributes(t *testing.T) {
ctx := context.Background()
bodySchema := &schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"customblock": {
Expand Down Expand Up @@ -113,7 +116,7 @@ func TestDecoder_CandidateAtPos_computedAttributes(t *testing.T) {
},
})

candidates, err := d.CandidatesAtPos("test.tf", hcl.Pos{
candidates, err := d.CandidatesAtPos(ctx, "test.tf", hcl.Pos{
Line: 2,
Column: 7,
Byte: 29,
Expand Down Expand Up @@ -154,6 +157,7 @@ func TestDecoder_CandidateAtPos_computedAttributes(t *testing.T) {
}

func TestDecoder_CandidateAtPos_incompleteBlocks(t *testing.T) {
ctx := context.Background()
bodySchema := &schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"customblock": {
Expand Down Expand Up @@ -186,7 +190,7 @@ func TestDecoder_CandidateAtPos_incompleteBlocks(t *testing.T) {
})
d.maxCandidates = 1

candidates, err := d.CandidatesAtPos("test.tf", hcl.Pos{
candidates, err := d.CandidatesAtPos(ctx, "test.tf", hcl.Pos{
Line: 3,
Column: 8,
Byte: 42,
Expand Down Expand Up @@ -227,6 +231,7 @@ func TestDecoder_CandidateAtPos_incompleteBlocks(t *testing.T) {
}

func TestDecoder_CandidateAtPos_duplicateNames(t *testing.T) {
ctx := context.Background()
bodySchema := &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"ingress": {
Expand Down Expand Up @@ -258,7 +263,7 @@ func TestDecoder_CandidateAtPos_duplicateNames(t *testing.T) {
},
})

candidates, err := d.CandidatesAtPos("test.tf", hcl.InitialPos)
candidates, err := d.CandidatesAtPos(ctx, "test.tf", hcl.InitialPos)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading

0 comments on commit ace4b0c

Please sign in to comment.