hclsyntax: use deep.Equal for TestParseTraversalAbs

This makes failure messages much easier to understand.
This commit is contained in:
Martin Atkins 2018-02-23 08:42:26 -08:00
parent 397fa07dea
commit 227ccafb01

View File

@ -3,9 +3,7 @@ package hclsyntax
import (
"testing"
"reflect"
"github.com/davecgh/go-spew/spew"
"github.com/go-test/deep"
"github.com/hashicorp/hcl2/hcl"
"github.com/zclconf/go-cty/cty"
)
@ -219,8 +217,10 @@ func TestParseTraversalAbs(t *testing.T) {
t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount)
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("wrong result\nsrc: %s\ngot: %s\nwant: %s", test.src, spew.Sdump(got), spew.Sdump(test.want))
if diff := deep.Equal(got, test.want); diff != nil {
for _, problem := range diff {
t.Error(problem)
}
}
})
}