1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00
goreleaser/main_test.go
Carlos Alexandro Becker 9bd0033c09
feat: refactor main.go to spf13/cobra (#1472)
* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: revert

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: lint

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: move

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-04-27 21:42:44 -03:00

46 lines
927 B
Go

package main
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestVersion(t *testing.T) {
for name, tt := range map[string]struct {
version, commit, date, builtBy string
out string
}{
"all empty": {
out: "",
},
"complete": {
version: "1.2.3",
date: "12/12/12",
commit: "aaaa",
builtBy: "me",
out: "1.2.3\ncommit: aaaa\nbuilt at: 12/12/12\nbuilt by: me",
},
"only version": {
version: "1.2.3",
out: "1.2.3",
},
"version and date": {
version: "1.2.3",
date: "12/12/12",
out: "1.2.3\nbuilt at: 12/12/12",
},
"version, date, built by": {
version: "1.2.3",
date: "12/12/12",
builtBy: "me",
out: "1.2.3\nbuilt at: 12/12/12\nbuilt by: me",
},
} {
tt := tt
t.Run(name, func(t *testing.T) {
require.Equal(t, tt.out, buildVersion(tt.version, tt.commit, tt.date, tt.builtBy))
})
}
}