udpate some tests with unexported gocmp options
This commit is contained in:
parent
913f6c2091
commit
15dad81e2b
|
@ -5,11 +5,19 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
proto "github.com/hashicorp/terraform/internal/tfplugin5"
|
||||
"github.com/hashicorp/terraform/tfdiags"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
)
|
||||
|
||||
var ignoreUnexported = cmpopts.IgnoreUnexported(
|
||||
proto.Diagnostic{},
|
||||
proto.Schema_Block{},
|
||||
proto.Schema_NestedBlock{},
|
||||
proto.Schema_Attribute{},
|
||||
)
|
||||
|
||||
func TestProtoDiagnostics(t *testing.T) {
|
||||
diags := WarnsAndErrsToProto(
|
||||
[]string{
|
||||
|
@ -41,8 +49,8 @@ func TestProtoDiagnostics(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
if !cmp.Equal(expected, diags) {
|
||||
t.Fatal(cmp.Diff(expected, diags))
|
||||
if !cmp.Equal(expected, diags, ignoreUnexported) {
|
||||
t.Fatal(cmp.Diff(expected, diags, ignoreUnexported))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -353,8 +353,8 @@ func TestConvertProtoSchemaBlocks(t *testing.T) {
|
|||
for name, tc := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
converted := ConfigSchemaToProto(tc.Block)
|
||||
if !cmp.Equal(converted, tc.Want, typeComparer, equateEmpty) {
|
||||
t.Fatal(cmp.Diff(converted, tc.Want, typeComparer, equateEmpty))
|
||||
if !cmp.Equal(converted, tc.Want, typeComparer, equateEmpty, ignoreUnexported) {
|
||||
t.Fatal(cmp.Diff(converted, tc.Want, typeComparer, equateEmpty, ignoreUnexported))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue