test: remove api that should not be used (#15678)
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package testutil
|
||||
|
||||
import "testing"
|
||||
|
||||
func AssertPanics(t *testing.T, f func()) {
|
||||
panicked := false
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
panicked = true
|
||||
}
|
||||
}()
|
||||
f()
|
||||
if !panicked {
|
||||
t.Errorf("should panic")
|
||||
}
|
||||
}
|
||||
|
||||
func AssertNotPanics(t *testing.T, f func()) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("should not panic: %v", r)
|
||||
}
|
||||
}()
|
||||
f()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
)
|
||||
|
||||
// RequireProtoDeepEqual fails the test t if p1 and p2 are not equivalent protobuf messages.
|
||||
// Where p1 and p2 are proto.Message or slices of proto.Message.
|
||||
func RequireProtoDeepEqual(t *testing.T, p1, p2 interface{}) {
|
||||
t.Helper()
|
||||
require.Empty(t, cmp.Diff(p1, p2, protocmp.Transform()))
|
||||
}
|
||||
Reference in New Issue
Block a user