Skip to content

Commit

Permalink
Make TestNotHandled work with Go 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-nichter committed Dec 8, 2022
1 parent 847b043 commit d97d7b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"reflect"
"testing"
"time"
"unsafe"

"github.com/go-test/deep"
v1 "github.com/go-test/deep/test/v1"
Expand Down Expand Up @@ -313,8 +314,12 @@ func TestMaxDiff(t *testing.T) {
func TestNotHandled(t *testing.T) {
// UnsafePointer is pretty much the only kind not handled now
v := []int{1}
a := reflect.ValueOf(v).UnsafePointer()
b := reflect.ValueOf(v).UnsafePointer()
a := unsafe.Pointer(&v)
b := unsafe.Pointer(&v)
// UnsafePointer added in Go 1.88. Use these lines once this pkg
// no longer supports Go 1.17.
//a := reflect.ValueOf(v).UnsafePointer()
//b := reflect.ValueOf(v).UnsafePointer()
diff := deep.Equal(a, b)
if len(diff) > 0 {
t.Error("got diffs:", diff)
Expand Down
3 changes: 3 additions & 0 deletions test/coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
go test -coverprofile=coverage.out "$@"
go tool cover -html=coverage.out

0 comments on commit d97d7b6

Please sign in to comment.