You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
smug/options_test.go

42 lines
695 B
Go

package main
import (
"reflect"
"testing"
"github.com/docopt/docopt-go"
)
var usageTestTable = []struct {
argv []string
opts Options
}{
{
[]string{"start", "smug"},
Options{"start", "smug", []string{}},
},
{
[]string{"start", "smug", "-wfoo"},
Options{"start", "smug", []string{"foo"}},
},
{
[]string{"start", "smug:foo,bar"},
Options{"start", "smug", []string{"foo", "bar"}},
},
}
func TestParseOptions(t *testing.T) {
parser := docopt.Parser{}
for _, v := range usageTestTable {
opts, err := ParseOptions(parser, v.argv)
if err != nil {
t.Fail()
}
if !reflect.DeepEqual(v.opts, opts) {
t.Errorf("expected struct %v, got %v", v.opts, opts)
}
}
}