diff options
Diffstat (limited to 'subcommand_test.go')
| -rw-r--r-- | subcommand_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/subcommand_test.go b/subcommand_test.go new file mode 100644 index 0000000..d17c604 --- /dev/null +++ b/subcommand_test.go @@ -0,0 +1,27 @@ +package arg + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +// This file contains tests for parse.go but I decided to put them here +// since that file is getting large + +func TestSubcommandNotAStruct(t *testing.T) { + var args struct { + A string `arg:"subcommand"` + } + _, err := NewParser(Config{}, &args) + assert.Error(t, err) +} + +func TestPositionalAndSubcommandNotAllowed(t *testing.T) { + var args struct { + A string `arg:"positional"` + B struct{} `arg:"subcommand"` + } + _, err := NewParser(Config{}, &args) + assert.Error(t, err) +} |
