diff options
Diffstat (limited to 'hclsyntax/parser_test.go')
| -rw-r--r-- | hclsyntax/parser_test.go | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/hclsyntax/parser_test.go b/hclsyntax/parser_test.go index 90a7583..10825f1 100644 --- a/hclsyntax/parser_test.go +++ b/hclsyntax/parser_test.go @@ -5,19 +5,16 @@ package hclsyntax import ( "fmt" + "sync" "testing" - "github.com/go-test/deep" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/hcl/v2" + "github.com/zclconf/go-cty-debug/ctydebug" "github.com/zclconf/go-cty/cty" ) -func init() { - deep.MaxDepth = 999 -} - func TestParseConfig(t *testing.T) { tests := []struct { input string @@ -2197,6 +2194,7 @@ block "valid" {} "a": { Name: "a", Expr: &LiteralValueExpr{ + Val: cty.DynamicVal, SrcRange: hcl.Range{ Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, @@ -2235,6 +2233,7 @@ block "valid" {} "a": { Name: "a", Expr: &LiteralValueExpr{ + Val: cty.DynamicVal, SrcRange: hcl.Range{ Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, @@ -2687,11 +2686,23 @@ block "valid" {} } got := file.Body - - if diff := deep.Equal(got, test.want); diff != nil { - for _, problem := range diff { - t.Errorf(problem) - } + diff := cmp.Diff( + test.want, got, + cmp.AllowUnexported( + Body{}, + AnonSymbolExpr{}, + hcl.TraverseRoot{}, + hcl.TraverseAttr{}, + hcl.TraverseIndex{}, + ), + cmpopts.IgnoreUnexported( + sync.Mutex{}, + sync.RWMutex{}, + ), + ctydebug.CmpOptions, + ) + if diff != "" { + t.Errorf("wrong result\n%s", diff) } }) } @@ -4006,10 +4017,8 @@ func TestParseConfigDiagnostics(t *testing.T) { t.Logf("\n%s", test.input) _, diags := ParseConfig([]byte(test.input), "test.hcl", hcl.InitialPos) - if diff := deep.Equal(diags, test.want); diff != nil { - for _, problem := range diff { - t.Errorf(problem) - } + if diff := cmp.Diff(test.want, diags); diff != "" { + t.Errorf("wrong diagnostics\n%s", diff) } }) } |
