@@ -13,42 +13,39 @@ import (
1313 "strings"
1414 "testing"
1515
16+ "github.com/google/go-cmp/cmp"
1617 "github.com/gotestyourself/gotestyourself/assert"
1718 is "github.com/gotestyourself/gotestyourself/assert/cmp"
1819)
1920
2021func TestParseRemoteURL (t * testing.T ) {
2122 dir , err := parseRemoteURL ("git://github.com/user/repo.git" )
2223 assert .NilError (t , err )
23- assert .Check (t , len (dir ) != 0 )
24- assert .Check (t , is .DeepEqual (gitRepo {"git://github.com/user/repo.git" , "master" , "" }, dir ))
24+ assert .Check (t , is .DeepEqual (gitRepo {"git://github.com/user/repo.git" , "master" , "" }, dir , cmpGitRepoOpt ))
2525
2626 dir , err = parseRemoteURL ("git://github.com/user/repo.git#mybranch:mydir/mysubdir/" )
2727 assert .NilError (t , err )
28- assert .Check (t , len (dir ) != 0 )
29- assert .Check (t , is .DeepEqual (gitRepo {"git://github.com/user/repo.git" , "mybranch" , "mydir/mysubdir/" }, dir ))
28+ assert .Check (t , is .DeepEqual (gitRepo {"git://github.com/user/repo.git" , "mybranch" , "mydir/mysubdir/" }, dir , cmpGitRepoOpt ))
3029
3130 dir , err = parseRemoteURL ("https://github.com/user/repo.git" )
3231 assert .NilError (t , err )
33- assert .Check (t , len (dir ) != 0 )
34- assert .Check (t , is .DeepEqual (gitRepo {"https://github.com/user/repo.git" , "master" , "" }, dir ))
32+ assert .Check (t , is .DeepEqual (gitRepo {"https://github.com/user/repo.git" , "master" , "" }, dir , cmpGitRepoOpt ))
3533
3634 dir , err = parseRemoteURL ("https://github.com/user/repo.git#mybranch:mydir/mysubdir/" )
3735 assert .NilError (t , err )
38- assert .Check (t , len (dir ) != 0 )
39- assert .Check (t , is .DeepEqual (gitRepo {"https://github.com/user/repo.git" , "mybranch" , "mydir/mysubdir/" }, dir ))
36+ assert .Check (t , is .DeepEqual (gitRepo {"https://github.com/user/repo.git" , "mybranch" , "mydir/mysubdir/" }, dir , cmpGitRepoOpt ))
4037
4138 dir ,
err = parseRemoteURL (
"[email protected] :user/repo.git" )
4239 assert .NilError (t , err )
43- assert .Check (t , len (dir ) != 0 )
44- assert .
Check (
t ,
is .
DeepEqual (
gitRepo {
"[email protected] :user/repo.git" ,
"master" ,
"" },
dir ))
40+ assert .
Check (
t ,
is .
DeepEqual (
gitRepo {
"[email protected] :user/repo.git" ,
"master" ,
"" },
dir ,
cmpGitRepoOpt ))
4541
4642 dir ,
err = parseRemoteURL (
"[email protected] :user/repo.git#mybranch:mydir/mysubdir/" )
4743 assert .NilError (t , err )
48- assert .Check (t , len (dir ) != 0 )
49- assert .
Check (
t ,
is .
DeepEqual (
gitRepo {
"[email protected] :user/repo.git" ,
"mybranch" ,
"mydir/mysubdir/" },
dir ))
44+ assert .
Check (
t ,
is .
DeepEqual (
gitRepo {
"[email protected] :user/repo.git" ,
"mybranch" ,
"mydir/mysubdir/" },
dir ,
cmpGitRepoOpt ))
5045}
5146
47+ var cmpGitRepoOpt = cmp .AllowUnexported (gitRepo {})
48+
5249func TestCloneArgsSmartHttp (t * testing.T ) {
5350 mux := http .NewServeMux ()
5451 server := httptest .NewServer (mux )
0 commit comments