test no such subcommand
This commit is contained in:
parent
237c5e2b23
commit
5b649de043
|
@ -28,8 +28,8 @@ func TestSubcommandNotAPointerToStruct(t *testing.T) {
|
||||||
|
|
||||||
func TestPositionalAndSubcommandNotAllowed(t *testing.T) {
|
func TestPositionalAndSubcommandNotAllowed(t *testing.T) {
|
||||||
var args struct {
|
var args struct {
|
||||||
A string `arg:"positional"`
|
A string `arg:"positional"`
|
||||||
B struct{} `arg:"subcommand"`
|
B *struct{} `arg:"subcommand"`
|
||||||
}
|
}
|
||||||
_, err := NewParser(Config{}, &args)
|
_, err := NewParser(Config{}, &args)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
@ -46,6 +46,16 @@ func TestMinimalSubcommand(t *testing.T) {
|
||||||
assert.NotNil(t, args.List)
|
assert.NotNil(t, args.List)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNoSuchSubcommand(t *testing.T) {
|
||||||
|
type listCmd struct {
|
||||||
|
}
|
||||||
|
var args struct {
|
||||||
|
List *listCmd `arg:"subcommand"`
|
||||||
|
}
|
||||||
|
err := parse("invalid", &args)
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func TestNamedSubcommand(t *testing.T) {
|
func TestNamedSubcommand(t *testing.T) {
|
||||||
type listCmd struct {
|
type listCmd struct {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue