summaryrefslogtreecommitdiff
path: root/subcommand_test.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2019-04-30 12:54:39 -0700
committerAlex Flint <[email protected]>2019-04-30 12:54:39 -0700
commit6a796e2c4131f734028186c023c32e08b5ef7758 (patch)
tree79a5455654a3a9b8cb696d57f06517b5ed3218c5 /subcommand_test.go
parent4e977796af5ef0863a674ef468c5036dcca20623 (diff)
add first two subcommand tests
Diffstat (limited to 'subcommand_test.go')
-rw-r--r--subcommand_test.go27
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)
+}