mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-22 04:08:49 +02:00
test: default values for envs
refs #1795 Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
64c73d7eba
commit
ce7d3b0e89
@ -140,6 +140,9 @@ func TestWithEnv(t *testing.T) {
|
|||||||
func TestFuncMap(t *testing.T) {
|
func TestFuncMap(t *testing.T) {
|
||||||
ctx := context.New(config.Project{
|
ctx := context.New(config.Project{
|
||||||
ProjectName: "proj",
|
ProjectName: "proj",
|
||||||
|
Env: []string{
|
||||||
|
"FOO=bar",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -155,6 +158,16 @@ func TestFuncMap(t *testing.T) {
|
|||||||
Name: "replace",
|
Name: "replace",
|
||||||
Expected: "1.24",
|
Expected: "1.24",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Template: `{{ if index .Env "SOME_ENV" }}{{ .Env.SOME_ENV }}{{ else }}default value{{ end }}`,
|
||||||
|
Name: "default value",
|
||||||
|
Expected: "default value",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Template: `{{ if index .Env "FOO" }}{{ .Env.FOO }}{{ else }}default value{{ end }}`,
|
||||||
|
Name: "default value set",
|
||||||
|
Expected: "bar",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Template: `{{ time "2006-01-02" }}`,
|
Template: `{{ time "2006-01-02" }}`,
|
||||||
Name: "time YYYY-MM-DD",
|
Name: "time YYYY-MM-DD",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user