Refactor RefName (#33234)

And fix some FIXMEs
This commit is contained in:
wxiaoguang 2025-01-13 14:01:53 +08:00 committed by GitHub
parent 81352542fd
commit 2ea929a952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 58 additions and 60 deletions

View file

@ -32,9 +32,8 @@ func TestRefName(t *testing.T) {
assert.Equal(t, "c0ffee", RefName("c0ffee").ShortName())
}
func TestRefURL(t *testing.T) {
repoURL := "/user/repo"
assert.Equal(t, repoURL+"/src/branch/foo", RefURL(repoURL, "refs/heads/foo"))
assert.Equal(t, repoURL+"/src/tag/foo", RefURL(repoURL, "refs/tags/foo"))
assert.Equal(t, repoURL+"/src/commit/c0ffee", RefURL(repoURL, "c0ffee"))
func TestRefWebLinkPath(t *testing.T) {
assert.Equal(t, "branch/foo", RefName("refs/heads/foo").RefWebLinkPath())
assert.Equal(t, "tag/foo", RefName("refs/tags/foo").RefWebLinkPath())
assert.Equal(t, "commit/c0ffee", RefName("c0ffee").RefWebLinkPath())
}