mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-07 18:27:03 +00:00
fix: multiple extra-files are not evaluated properly (#61)
Quoting issues caused multiple extra-files to be ignored.
This commit is contained in:
parent
7a3d46eac7
commit
2567293368
4 changed files with 68 additions and 3 deletions
59
cmd/rp/cmd/run_test.go
Normal file
59
cmd/rp/cmd/run_test.go
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_parseExtraFiles(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
input: ``,
|
||||
want: []string{},
|
||||
},
|
||||
{
|
||||
name: "empty quoted",
|
||||
input: `""`,
|
||||
want: []string{},
|
||||
},
|
||||
{
|
||||
name: "single",
|
||||
input: `foo.txt`,
|
||||
want: []string{"foo.txt"},
|
||||
},
|
||||
{
|
||||
name: "single quoted",
|
||||
input: `"foo.txt"`,
|
||||
want: []string{"foo.txt"},
|
||||
},
|
||||
{
|
||||
name: "multiple",
|
||||
input: `foo.txt
|
||||
dir/Chart.yaml`,
|
||||
want: []string{"foo.txt", "dir/Chart.yaml"},
|
||||
},
|
||||
{
|
||||
name: "multiple quoted",
|
||||
input: `"foo.txt
|
||||
dir/Chart.yaml"`,
|
||||
want: []string{"foo.txt", "dir/Chart.yaml"},
|
||||
},
|
||||
{
|
||||
name: "multiple with broken new lines",
|
||||
input: `"action.yml\ntemplates/run.yml\n"`,
|
||||
want: []string{"action.yml", "templates/run.yml"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := parseExtraFiles(tt.input)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue