open-consul/proto/prototest/testing.go

19 lines
398 B
Go
Raw Normal View History

2022-03-28 17:56:44 +00:00
package prototest
import (
"testing"
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/testing/protocmp"
2022-03-28 17:56:44 +00:00
)
func AssertDeepEqual(t testing.TB, x, y interface{}, opts ...cmp.Option) {
2022-03-28 17:56:44 +00:00
t.Helper()
opts = append(opts, protocmp.Transform())
2022-03-28 17:56:44 +00:00
if diff := cmp.Diff(x, y, opts...); diff != "" {
t.Fatalf("assertion failed: values are not equal\n--- expected\n+++ actual\n%v", diff)
}
}