We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 960d38c commit e7a4f77Copy full SHA for e7a4f77
subcommand_test.go
@@ -495,3 +495,14 @@ func TestValForNilStruct(t *testing.T) {
495
v := p.val(path{fields: []reflect.StructField{subField, subField}})
496
assert.False(t, v.IsValid())
497
}
498
+
499
+func TestSubcommandInvalidInternal(t *testing.T) {
500
+ // this situation should never arise in practice but still good to test for it
501
+ var cmd struct{}
502
+ p, err := NewParser(Config{}, &cmd)
503
+ require.NoError(t, err)
504
505
+ p.subcommand = []string{"should", "never", "happen"}
506
+ sub := p.Subcommand()
507
+ assert.Nil(t, sub)
508
+}
0 commit comments