Skip to content

Commit d97d7b6

Browse files
Make TestNotHandled work with Go 1.17
1 parent 847b043 commit d97d7b6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

deep_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"reflect"
77
"testing"
88
"time"
9+
"unsafe"
910

1011
"github.com/go-test/deep"
1112
v1 "github.com/go-test/deep/test/v1"
@@ -313,8 +314,12 @@ func TestMaxDiff(t *testing.T) {
313314
func TestNotHandled(t *testing.T) {
314315
// UnsafePointer is pretty much the only kind not handled now
315316
v := []int{1}
316-
a := reflect.ValueOf(v).UnsafePointer()
317-
b := reflect.ValueOf(v).UnsafePointer()
317+
a := unsafe.Pointer(&v)
318+
b := unsafe.Pointer(&v)
319+
// UnsafePointer added in Go 1.88. Use these lines once this pkg
320+
// no longer supports Go 1.17.
321+
//a := reflect.ValueOf(v).UnsafePointer()
322+
//b := reflect.ValueOf(v).UnsafePointer()
318323
diff := deep.Equal(a, b)
319324
if len(diff) > 0 {
320325
t.Error("got diffs:", diff)

test/coverage

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
go test -coverprofile=coverage.out "$@"
3+
go tool cover -html=coverage.out

0 commit comments

Comments
 (0)