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

Commit 8dcaab5

Browse files
committed
Fix deduceConstraint test to not rely upon the types being comparable
1 parent 5285e62 commit 8dcaab5

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"
@@ -31,10 +32,16 @@ func TestDeduceConstraint(t *testing.T) {
3132
"20120425195858-psty8c35ve2oej8t": gps.NewVersion("20120425195858-psty8c35ve2oej8t"),
3233
}
3334

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

0 commit comments

Comments
 (0)