add first two subcommand tests

This commit is contained in:
Alex Flint 2019-04-30 12:54:39 -07:00
parent 4e977796af
commit 6a796e2c41
1 changed files with 27 additions and 0 deletions

27
subcommand_test.go Normal file
View File

@ -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)
}