version_test.go 298 B

123456789101112131415161718
  1. package commands
  2. import (
  3. "bytes"
  4. "strings"
  5. "testing"
  6. "gotest.tools/v3/assert"
  7. )
  8. func TestVersion(t *testing.T) {
  9. root := NewRootCmd(nil)
  10. var out bytes.Buffer
  11. root.SetOut(&out)
  12. root.SetArgs([]string{"version"})
  13. root.Execute()
  14. assert.Check(t, strings.Contains(out.String(), Version))
  15. }