1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00
goreleaser/pkg/config/config_homebrew_dependency_test.go
Carlos Alexandro Becker 860b4a8f81
chore: gofumpt & lint (#2190)
Signed-off-by: Carlos Becker <caarlos0@gmail.com>
2021-04-25 14:20:49 -03:00

73 lines
1.2 KiB
Go

package config
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func TestUnmarshalHomebrewDependency(t *testing.T) {
t.Run("string arr", func(t *testing.T) {
conf := `
brews:
- name: foo
dependencies:
- foo
- bar
`
buf := strings.NewReader(conf)
prop, err := LoadReader(buf)
require.NoError(t, err)
require.Equal(t, []HomebrewDependency{
{
Name: "foo",
}, {
Name: "bar",
},
}, prop.Brews[0].Dependencies)
})
t.Run("mixed", func(t *testing.T) {
conf := `
brews:
- name: foo
dependencies:
- name: foo
- bar
- name: foobar
type: optional
`
buf := strings.NewReader(conf)
prop, err := LoadReader(buf)
require.NoError(t, err)
require.Equal(t, []HomebrewDependency{
{
Name: "foo",
}, {
Name: "bar",
}, {
Name: "foobar",
Type: "optional",
},
}, prop.Brews[0].Dependencies)
})
t.Run("mixed", func(t *testing.T) {
conf := `
brews:
- name: foo
dependencies:
- name: foo
- namer: bar
- asdda
`
buf := strings.NewReader(conf)
_, err := LoadReader(buf)
require.EqualError(t, err, "yaml: unmarshal errors:\n line 6: field namer not found in type config.homebrewDependency")
})
}