Browse code

deal with RawPath field added to url.URL in go1.5

gabemontero authored on 2016/01/08 05:59:55
Showing 1 changed files
... ...
@@ -5,7 +5,6 @@ import (
5 5
 	"net/url"
6 6
 	"os"
7 7
 	"path/filepath"
8
-	"reflect"
9 8
 	"testing"
10 9
 )
11 10
 
... ...
@@ -111,7 +110,16 @@ func TestParseRepository(t *testing.T) {
111 111
 			t.Errorf("ParseRepository returned err: %v", err)
112 112
 		}
113 113
 
114
-		if !reflect.DeepEqual(*got, want) {
114
+		// go1.5 added the RawPath field to url.URL; it is not a field we need to manipulate with the
115
+		// ParseRepository path, but it impacts the values set in our test results array and doing a
116
+		// DeepEqual compare; hence, we have reverted back to a field by field compare (which
117
+		// this test originally did)
118
+		if got.Scheme != want.Scheme ||
119
+			got.Host != want.Host ||
120
+			got.Path != want.Path ||
121
+			(got.User != nil && want.User != nil && got.User.Username() != want.User.Username()) ||
122
+			(got.User == nil && want.User != nil) ||
123
+			(got.User != nil && want.User == nil) {
115 124
 			t.Errorf("%s: got %#v, want %#v", scenario, *got, want)
116 125
 		}
117 126
 	}