|
@@ -41,6 +41,14 @@ func TestInferSubmoduleURL(t *testing.T) {
|
|
|
},
|
|
|
expURL: "http://github.com/gogs/docs-api/commit/6b08f76a5313fa3d26859515b30aa17a5faa2807",
|
|
|
},
|
|
|
+ {
|
|
|
+ name: "relative path",
|
|
|
+ submodule: &git.Submodule{
|
|
|
+ URL: "../repo2.git",
|
|
|
+ Commit: "6b08f76a5313fa3d26859515b30aa17a5faa2807",
|
|
|
+ },
|
|
|
+ expURL: "https://gogs.example.com/user/repo/../repo2/commit/6b08f76a5313fa3d26859515b30aa17a5faa2807",
|
|
|
+ },
|
|
|
{
|
|
|
name: "bad URL",
|
|
|
submodule: &git.Submodule{
|
|
@@ -52,7 +60,7 @@ func TestInferSubmoduleURL(t *testing.T) {
|
|
|
}
|
|
|
for _, test := range tests {
|
|
|
t.Run(test.name, func(t *testing.T) {
|
|
|
- assert.Equal(t, test.expURL, InferSubmoduleURL(test.submodule))
|
|
|
+ assert.Equal(t, test.expURL, InferSubmoduleURL("https://gogs.example.com/user/repo", test.submodule))
|
|
|
})
|
|
|
}
|
|
|
}
|