pdbethke/cli at 059cddd42f: the project's own tests caught 1 of 2 planted faults, 1 got through, and corral proved 1 of those missing tests by writing a test and running it.
package cli
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCorralMutexCategoryReachesEveryOptionPath(t *testing.T) {
first := &StringFlag{Name: "corral-first"}
second := &StringFlag{Name: "corral-second"}
third := &StringFlag{Name: "corral-third"}
fourth := &StringFlag{Name: "corral-fourth"}
grp := MutuallyExclusiveFlags{
Category: "corral-category",
Flags: [][]Flag{
{first, second},
{third, fourth},
},
}
// Exercise category propagation implemented in flag_mutex.go.
grp.propagateCategory()
assert.Equal(t, grp.Category, first.Category)
assert.Equal(t, grp.Category, second.Category)
assert.Equal(t, grp.Category, third.Category)
assert.Equal(t, grp.Category, fourth.Category)
}
A proven fault was caught by a test corral wrote and ran; an unproven one was not, so it may be a missing test or a fault no test can see.
s3/m4 · line 74 proven
- for _, grpf := range grp.Flags {
+ for i, grpf := range grp.Flags {
+ if i > 0 {
+ break
+ }