mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
afda24a1e9
refs #1858 # #1859 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
26 lines
827 B
Go
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")
|
|
})
|
|
}
|
|
}
|