Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit c1a7ef1

Browse files
committed
Fix deduceConstraint test to not rely upon the types being comparable
1 parent e2122e4 commit c1a7ef1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cmd/dep/ensure_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package main
66

77
import (
8+
"reflect"
89
"testing"
910

1011
"github.com/golang/dep/internal/gps"
@@ -29,10 +30,16 @@ func TestDeduceConstraint(t *testing.T) {
2930
"20120425195858-psty8c35ve2oej8t": gps.NewVersion("20120425195858-psty8c35ve2oej8t"),
3031
}
3132

32-
for str, expected := range constraints {
33-
c := deduceConstraint(str)
34-
if c != expected {
35-
t.Fatalf("expected: %#v, got %#v for %s", expected, c, str)
33+
for str, want := range constraints {
34+
got := deduceConstraint(str)
35+
36+
wantT := reflect.TypeOf(want)
37+
gotT := reflect.TypeOf(got)
38+
if wantT != gotT {
39+
t.Errorf("expected type: %s, got %s, for input %s", wantT, gotT, str)
40+
}
41+
if got.String() != want.String() {
42+
t.Errorf("expected value: %s, got %s for input %s", want, got, str)
3643
}
3744
}
3845
}

0 commit comments

Comments
 (0)