Files
jarl/internal/version/version_test.go
T
abrown38andClaude Opus 5.5 db9ebb14dd Show the build in a footer, linked to its release or commit
The version moves from the header to a "Powered by Jarl" footer. A build
of a release tag (HEAD tagged v<VERSION>, no tracked changes; the release
workflow sets RELEASE_TAG) shows and links the release; any other build
shows and links its commit, marked -modified with uncommitted changes.
jarld version, jarl --version, /status and /auth/whoami report the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 14:48:24 +00:00

23 lines
678 B
Go

package version
import "testing"
func TestDescribe(t *testing.T) {
const c = "4d00be5e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c"
for _, tc := range []struct {
tag, commit string
modified bool
label, url string
}{
{"v0.1.0", c, true, "v0.1.0", Repo + "/releases/tag/v0.1.0"},
{"", c, false, "4d00be5e1f0a", Repo + "/commit/" + c},
{"", c, true, "4d00be5e1f0a-modified", Repo + "/commit/" + c},
{"", "", false, "0.1.0", Repo},
} {
b := describe("0.1.0", tc.tag, tc.commit, tc.modified)
if b.Label != tc.label || b.URL != tc.url {
t.Errorf("describe(%q, %q, %v) = %q %q, want %q %q", tc.tag, tc.commit, tc.modified, b.Label, b.URL, tc.label, tc.url)
}
}
}