@@ -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
1616	t .Run ("GitHubRepo" , func (t  * testing.T ) {
17- 		curRepoLink  :=  "/any/repo-home-link" 
18- 		sf  :=  NewCommitSubmoduleFile (
"full-path" , 
"[email protected] :user/repo.git" , 
"aaaa" )
 19- 		wl  :=  sf .SubmoduleWebLinkTree (t .Context (), curRepoLink , sf .RefID ())
17+ 		sf  :=  NewCommitSubmoduleFile (
"/any/repo-ink" , 
"full-path" , 
"[email protected] :user/repo.git" , 
"aaaa" )
 18+ 		wl  :=  sf .SubmoduleWebLinkTree (t .Context (), sf .RefID ())
2019		assert .Equal (t , "https://github.com/user/repo" , wl .RepoWebLink )
2120		assert .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" )
2423		assert .Equal (t , "https://github.com/user/repo" , wl .RepoWebLink )
2524		assert .Equal (t , "https://github.com/user/repo/compare/1111...2222" , wl .CommitWebLink )
2625	})
2726
2827	t .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 ())
3230		assert .Equal (t , "/subpath/user/repo" , wl .RepoWebLink )
3331		assert .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" )
3735		assert .Equal (t , "/subpath/user/repo" , wl .RepoWebLink )
3836		assert .Equal (t , "/subpath/user/repo/compare/1111...2222" , wl .CommitWebLink )
3937	})
0 commit comments