mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
Merge pull request #331 from broady/fmtetc
gofmt, govet, run those in Travis
This commit is contained in:
commit
8e9c5e77eb
5 changed files with 21 additions and 14 deletions
18
.travis.yml
18
.travis.yml
|
@ -1,9 +1,13 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
|
||||||
- 1.4.3
|
matrix:
|
||||||
- 1.5.4
|
include:
|
||||||
- 1.6.3
|
- go: 1.4.3
|
||||||
- tip
|
env: NOVET=true # No bundled vet.
|
||||||
|
- go: 1.5.4
|
||||||
|
- go: 1.6.3
|
||||||
|
- go: 1.7
|
||||||
|
- go: tip
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
@ -16,3 +20,7 @@ before_install:
|
||||||
script:
|
script:
|
||||||
- PATH=$PATH:$PWD/bin go test -v ./...
|
- PATH=$PATH:$PWD/bin go test -v ./...
|
||||||
- go build
|
- go build
|
||||||
|
- diff -u <(echo -n) <(gofmt -d -s .)
|
||||||
|
- if [ -z $NOVET ]; then
|
||||||
|
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
|
||||||
|
fi
|
||||||
|
|
|
@ -155,7 +155,7 @@ func TestBashCompletionHiddenFlag(t *testing.T) {
|
||||||
cmdTrue.GenBashCompletion(out)
|
cmdTrue.GenBashCompletion(out)
|
||||||
bashCompletion := out.String()
|
bashCompletion := out.String()
|
||||||
if strings.Contains(bashCompletion, flagName) {
|
if strings.Contains(bashCompletion, flagName) {
|
||||||
t.Error("expected completion to not include %q flag: Got %v", flagName, bashCompletion)
|
t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -916,15 +916,14 @@ func TestRootUnknownCommand(t *testing.T) {
|
||||||
|
|
||||||
func TestRootUnknownCommandSilenced(t *testing.T) {
|
func TestRootUnknownCommandSilenced(t *testing.T) {
|
||||||
r := noRRSetupTestSilenced("bogus")
|
r := noRRSetupTestSilenced("bogus")
|
||||||
s := "Run 'cobra-test --help' for usage.\n"
|
|
||||||
|
|
||||||
if r.Output != "" {
|
if r.Output != "" {
|
||||||
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
|
t.Errorf("Unexpected response.\nExpecting to be: \n\"\"\n Got:\n %q\n", r.Output)
|
||||||
}
|
}
|
||||||
|
|
||||||
r = noRRSetupTestSilenced("--strtwo=a bogus")
|
r = noRRSetupTestSilenced("--strtwo=a bogus")
|
||||||
if r.Output != "" {
|
if r.Output != "" {
|
||||||
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
|
t.Errorf("Unexpected response.\nExpecting to be:\n\"\"\nGot:\n %q\n", r.Output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,11 @@ func TestCommandsAreSorted(t *testing.T) {
|
||||||
|
|
||||||
var tmpCommand = &Command{Use: "tmp"}
|
var tmpCommand = &Command{Use: "tmp"}
|
||||||
|
|
||||||
for _, name := range(originalNames) {
|
for _, name := range originalNames {
|
||||||
tmpCommand.AddCommand(&Command{Use: name})
|
tmpCommand.AddCommand(&Command{Use: name})
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range(tmpCommand.Commands()) {
|
for i, c := range tmpCommand.Commands() {
|
||||||
if expectedNames[i] != c.Name() {
|
if expectedNames[i] != c.Name() {
|
||||||
t.Errorf("expected: %s, got: %s", expectedNames[i], c.Name())
|
t.Errorf("expected: %s, got: %s", expectedNames[i], c.Name())
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,11 @@ func TestEnableCommandSortingIsDisabled(t *testing.T) {
|
||||||
|
|
||||||
var tmpCommand = &Command{Use: "tmp"}
|
var tmpCommand = &Command{Use: "tmp"}
|
||||||
|
|
||||||
for _, name := range(originalNames) {
|
for _, name := range originalNames {
|
||||||
tmpCommand.AddCommand(&Command{Use: name})
|
tmpCommand.AddCommand(&Command{Use: name})
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range(tmpCommand.Commands()) {
|
for i, c := range tmpCommand.Commands() {
|
||||||
if originalNames[i] != c.Name() {
|
if originalNames[i] != c.Name() {
|
||||||
t.Errorf("expected: %s, got: %s", originalNames[i], c.Name())
|
t.Errorf("expected: %s, got: %s", originalNames[i], c.Name())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue