1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-29 01:44:39 +02:00

fix(brew): version and os not being considered

closes #5123

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2024-09-09 22:25:21 -03:00
parent 4200454d4e
commit 04dfb72d57
No known key found for this signature in database
2 changed files with 41 additions and 0 deletions

View File

@ -175,6 +175,8 @@ func (a *HomebrewDependency) UnmarshalYAML(unmarshal func(interface{}) error) er
a.Name = dep.Name
a.Type = dep.Type
a.Version = dep.Version
a.OS = dep.OS
return nil
}

View File

@ -0,0 +1,39 @@
package config
import (
"testing"
"github.com/goreleaser/goreleaser/v2/internal/yaml"
"github.com/stretchr/testify/require"
)
func TestBrewDependencies_justString(t *testing.T) {
var actual Homebrew
err := yaml.UnmarshalStrict([]byte(`dependencies: ['xclip']`), &actual)
require.NoError(t, err)
require.Equal(t, Homebrew{
Dependencies: []HomebrewDependency{
{Name: "xclip"},
},
}, actual)
}
func TestBrewDependencies_full(t *testing.T) {
var actual Homebrew
err := yaml.UnmarshalStrict([]byte(`dependencies:
- name: xclip
os: linux
version: '~> v1'
type: optional`), &actual)
require.NoError(t, err)
require.Equal(t, Homebrew{
Dependencies: []HomebrewDependency{
{
Name: "xclip",
Type: "optional",
Version: "~> v1",
OS: "linux",
},
},
}, actual)
}