Skip to content

Commit

Permalink
fix print format error
Browse files Browse the repository at this point in the history
  • Loading branch information
shamaton committed Aug 22, 2024
1 parent 8c48060 commit 1671bb8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/common/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,20 @@ func Equal[T any](t *testing.T, actual, expected T) {
func EqualSlice[T comparable](t *testing.T, actual, expected []T) {
t.Helper()
if len(actual) != len(expected) {
switch any(actual).(type) {
switch a := any(actual).(type) {
case []byte:
t.Fatalf("diffrent length. actual: [% 02x], expected: [% 02x]", actual, expected)
e := any(expected).([]byte)
t.Fatalf("diffrent length. actual: [% 02x], expected: [% 02x]", a, e)
default:
t.Fatalf("diffrent length. actual: %v, expected: %v", actual, expected)
}
}
for i := range actual {
if !reflect.DeepEqual(actual[i], expected[i]) {
switch any(actual).(type) {
switch a := any(actual).(type) {
case []byte:
t.Fatalf("not equal. actual: [% 02x], expected: [% 02x]", actual, expected)
e := any(expected).([]byte)
t.Fatalf("not equal. actual: [% 02x], expected: [% 02x]", a, e)
default:
t.Fatalf("not equal. actual: %v, expected: %v", actual, expected)
}
Expand Down

0 comments on commit 1671bb8

Please sign in to comment.