Use nil instead of len for arg check.#224
Closed
jonreyna wants to merge 1 commit into
Closed
Conversation
This honors the SetArgs() call
squaremo
added a commit
to weaveworks-experiments/flux-classic
that referenced
this pull request
Jan 19, 2016
- ability to tap (and thereby test) the stdout and stderr, at the
mild cost of having to replace uses of fmt.Print{ln,f}. Use it to
test the output of `fluxctl list`
- convert all subcommands to use the `RunE` style of command, which
makes them easier to test (since they return an error rather than
panicking or worse, exiting altogether)
- add a test to the helpers, so that it imports "testing" (apparently
important for the coverage tool), and so there's a test
- work around a bug in cobra.Command, whereby supplying an empty
slice to `cmd.SetArgs(...)` makes it fall back to `os.Args[1:]`,
breaking the coverage tooling. (See
spf13/cobra#224)
Owner
|
Thanks for the fix. Merged as 1ef0913 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fix in #155 for go test -v breaks SetArgs().
meddling_monk at BorgCube in /media/meddling_monk/Bear/dev/golang/src/github.com/JReyLBC/testCobra $ go run test_cobra1.go abc Print: abcChecking if args is nil, instead of having a zero length, honors the use of SetArgs(), and doesn't break go test -v.