Skip to content

Commit

Permalink
Adding a mock for the BoolVarP method in tests
Browse files Browse the repository at this point in the history
This brings us to 100% coverage while I figure out a better way to
actually test with other libraries without adding them as dependencies.
  • Loading branch information
Rican7 committed Aug 11, 2023
1 parent 3ee02af commit 165cd45
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func (b *bogusFlags) PrintDefaults() {
func (b *bogusFlags) SetOutput(output io.Writer) {
}

// Provide method that's used by "pflag" libraries (like github.com/spf13/pflag)
// to validate that it's at least called in the interface checks.
func (b *bogusFlags) BoolVarP(p *bool, name string, shorthand string, value bool, usage string) {
}

func TestBogusFlags_WorkWithSingleCommandApps(t *testing.T) {
flagSet := &bogusFlags{id: "global"}
out := io.Discard
Expand Down

0 comments on commit 165cd45

Please sign in to comment.