1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/cmd/completion_test.go
Carlos Alexandro Becker afda24a1e9
feat: add fish completion (#1860)
refs #1858 # #1859

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-10-16 11:01:36 +00:00

26 lines
827 B
Go

package cmd
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
)
func TestCompletionGeneration(t *testing.T) {
for _, shell := range []string{"bash", "zsh", "fish"} {
t.Run(shell, func(t *testing.T) {
completionCmd := newCompletionCmd().cmd
stdout := bytes.NewBufferString("")
stderr := bytes.NewBufferString("")
completionCmd.SetOut(stdout)
completionCmd.SetErr(stderr)
completionCmd.SetArgs([]string{shell})
err := completionCmd.Execute()
require.NoError(t, err, shell+" arg experienced error with goreleaser completion:\n"+stderr.String())
require.Equal(t, "", stderr.String(), shell+" arg experienced error with goreleaser completion:\n"+stderr.String())
require.NotEmpty(t, stdout.String(), shell+" arg reported nothing to stdout with goreleaser completion")
})
}
}