Skip to content
Myr

Add basic test for prefix matching

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by tummychow · committed by tummychow · parent 96d543c · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:cobra_test.go+18 added
136 unmodified lines
137 t.Error("Command didn't parse correctly")138 }139}140141func TestChildCommandPrefix(t *testing.T) {142 c := initialize()143 cmdEcho.AddCommand(cmdTimes)144 c.AddCommand(cmdPrint, cmdEcho)145 c.SetArgs(strings.Split("ech tim one two", " "))146 c.Execute()147148 if te != nil || tp != nil {149 t.Error("Wrong command called")150 }151 if tt == nil {152 t.Error("Wrong command called")153 }154 if strings.Join(tt, " ") != "one two" {155 t.Error("Command didn't parse correctly")156 }157}158159func TestFlagLong(t *testing.T) {160 c := initialize()161 c.AddCommand(cmdPrint, cmdEcho, cmdTimes)162 c.SetArgs(strings.Split("echo --intone=13 something here", " "))
219 unmodified lines