test: remove api that should not be used (#15678)

This commit is contained in:
Julien Robert
2023-04-03 21:57:11 +00:00
committed by GitHub
parent 5e90819765
commit c3b1b37e49
6 changed files with 37 additions and 46 deletions
-25
View File
@@ -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()
}
+16
View File
@@ -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()))
}