@@ -10,30 +10,28 @@ import (
1010)
1111
1212func TestCommitSubmoduleLink (t * testing.T ) {
13- assert .Nil (t , (* CommitSubmoduleFile )(nil ).SubmoduleWebLinkTree (t .Context (),"" , "" ))
14- assert .Nil (t , (* CommitSubmoduleFile )(nil ).SubmoduleWebLinkCompare (t .Context (),"" ,"" , "" ))
13+ assert .Nil (t , (* CommitSubmoduleFile )(nil ).SubmoduleWebLinkTree (t .Context (),"" ))
14+ assert .Nil (t , (* CommitSubmoduleFile )(nil ).SubmoduleWebLinkCompare (t .Context (),"" ,"" ))
1515
1616t .Run ("GitHubRepo" ,func (t * testing.T ) {
17- curRepoLink := "/any/repo-home-link"
18- sf := NewCommitSubmoduleFile ("full-path" ,"git@github.com:user/repo.git" ,"aaaa" )
19- wl := sf .SubmoduleWebLinkTree (t .Context (),curRepoLink ,sf .RefID ())
17+ sf := NewCommitSubmoduleFile ("/any/repo-link" ,"full-path" ,"git@github.com:user/repo.git" ,"aaaa" )
18+ wl := sf .SubmoduleWebLinkTree (t .Context (),sf .RefID ())
2019assert .Equal (t ,"https://github.com/user/repo" ,wl .RepoWebLink )
2120assert .Equal (t ,"https://github.com/user/repo/tree/aaaa" ,wl .CommitWebLink )
2221
23- wl = sf .SubmoduleWebLinkCompare (t .Context (),curRepoLink , "1111" ,"2222" )
22+ wl = sf .SubmoduleWebLinkCompare (t .Context (),"1111" ,"2222" )
2423assert .Equal (t ,"https://github.com/user/repo" ,wl .RepoWebLink )
2524assert .Equal (t ,"https://github.com/user/repo/compare/1111...2222" ,wl .CommitWebLink )
2625})
2726
2827t .Run ("RelativePath" ,func (t * testing.T ) {
29- curRepoLink := "/subpath/any/repo-home-link"
30- sf := NewCommitSubmoduleFile ("full-path" ,"../../user/repo" ,"aaaa" )
31- wl := sf .SubmoduleWebLinkTree (t .Context (),curRepoLink ,sf .RefID ())
28+ sf := NewCommitSubmoduleFile ("/subpath/any/repo-home-link" ,"full-path" ,"../../user/repo" ,"aaaa" )
29+ wl := sf .SubmoduleWebLinkTree (t .Context (),sf .RefID ())
3230assert .Equal (t ,"/subpath/user/repo" ,wl .RepoWebLink )
3331assert .Equal (t ,"/subpath/user/repo/tree/aaaa" ,wl .CommitWebLink )
3432
35- sf = NewCommitSubmoduleFile ("dir/submodule" ,"../../../user/repo" ,"aaaa" )
36- wl = sf .SubmoduleWebLinkCompare (t .Context (),curRepoLink , "1111" ,"2222" )
33+ sf = NewCommitSubmoduleFile ("/subpath/any/repo-home-link" , " dir/submodule" ,"../../../user/repo" ,"aaaa" )
34+ wl = sf .SubmoduleWebLinkCompare (t .Context (),"1111" ,"2222" )
3735assert .Equal (t ,"/subpath/user/repo" ,wl .RepoWebLink )
3836assert .Equal (t ,"/subpath/user/repo/compare/1111...2222" ,wl .CommitWebLink )
3937})