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") } }