1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-09-16 09:26:52 +02:00

test: fix broken test

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2021-07-24 00:27:20 -03:00
parent 6ecddbd7e9
commit 0935faf8e2
2 changed files with 8 additions and 6 deletions

View File

@@ -24,6 +24,8 @@ func main() {
) )
} }
const website = "\n\nhttps://goreleaser.com"
func buildVersion(version, commit, date, builtBy string) string { func buildVersion(version, commit, date, builtBy string) string {
result := version result := version
if commit != "" { if commit != "" {
@@ -38,5 +40,5 @@ func buildVersion(version, commit, date, builtBy string) string {
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" { if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {
result = fmt.Sprintf("%s\nmodule version: %s, checksum: %s", result, info.Main.Version, info.Main.Sum) result = fmt.Sprintf("%s\nmodule version: %s, checksum: %s", result, info.Main.Version, info.Main.Sum)
} }
return result + "\n\nhttps://goreleaser.com" return result + website
} }

View File

@@ -12,29 +12,29 @@ func TestVersion(t *testing.T) {
out string out string
}{ }{
"all empty": { "all empty": {
out: "", out: website,
}, },
"complete": { "complete": {
version: "1.2.3", version: "1.2.3",
date: "12/12/12", date: "12/12/12",
commit: "aaaa", commit: "aaaa",
builtBy: "me", builtBy: "me",
out: "1.2.3\ncommit: aaaa\nbuilt at: 12/12/12\nbuilt by: me", out: "1.2.3\ncommit: aaaa\nbuilt at: 12/12/12\nbuilt by: me" + website,
}, },
"only version": { "only version": {
version: "1.2.3", version: "1.2.3",
out: "1.2.3", out: "1.2.3" + website,
}, },
"version and date": { "version and date": {
version: "1.2.3", version: "1.2.3",
date: "12/12/12", date: "12/12/12",
out: "1.2.3\nbuilt at: 12/12/12", out: "1.2.3\nbuilt at: 12/12/12" + website,
}, },
"version, date, built by": { "version, date, built by": {
version: "1.2.3", version: "1.2.3",
date: "12/12/12", date: "12/12/12",
builtBy: "me", builtBy: "me",
out: "1.2.3\nbuilt at: 12/12/12\nbuilt by: me", out: "1.2.3\nbuilt at: 12/12/12\nbuilt by: me" + website,
}, },
} { } {
tt := tt tt := tt