All checks were successful
Beta Release / beta (push) Successful in 31s
- Add develop branch for integration - Replace single ci.yml with 3 workflows: ci-pr (PR checks), ci-develop (beta releases), ci-main (stable releases) - Add prerelease support in version.go (ldflags injection) - Add tests for prerelease version formatting - Document full GitFlow process, versioning, and contributing guide in README 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package version
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestFullVersion(t *testing.T) {
|
|
v := FullVersion()
|
|
if !strings.HasPrefix(v, Name) {
|
|
t.Errorf("FullVersion should start with %s, got %s", Name, v)
|
|
}
|
|
if !strings.Contains(v, "v"+Version) {
|
|
t.Errorf("FullVersion should contain v%s, got %s", Version, v)
|
|
}
|
|
}
|
|
|
|
func TestFullVersionWithPrerelease(t *testing.T) {
|
|
original := Prerelease
|
|
Prerelease = "beta.1"
|
|
defer func() { Prerelease = original }()
|
|
|
|
v := FullVersion()
|
|
if !strings.Contains(v, "beta.1") {
|
|
t.Errorf("FullVersion should contain prerelease suffix, got %s", v)
|
|
}
|
|
}
|
|
|
|
func TestFullVersionWithoutPrerelease(t *testing.T) {
|
|
original := Prerelease
|
|
Prerelease = ""
|
|
defer func() { Prerelease = original }()
|
|
|
|
v := FullVersion()
|
|
if strings.Contains(v, "-") {
|
|
t.Errorf("FullVersion should not contain prerelease suffix, got %s", v)
|
|
}
|
|
}
|
|
|
|
func TestConstants(t *testing.T) {
|
|
if Name == "" {
|
|
t.Error("Name should not be empty")
|
|
}
|
|
if Version == "" {
|
|
t.Error("Version should not be empty")
|
|
}
|
|
if Author == "" {
|
|
t.Error("Author should not be empty")
|
|
}
|
|
if License == "" {
|
|
t.Error("License should not be empty")
|
|
}
|
|
}
|