@@ -124,22 +124,22 @@ func TestCaseInsensitiveCommandNames(t *testing.T) {
124124
125125 app .setup ()
126126
127- if c := app .BestCommand ("project:list" ); c != projectList {
127+ if c , _ := app .BestCommand ("project:list" ); c != projectList {
128128 t .Fatalf ("expected project:list, got %v" , c )
129129 }
130- if c := app .BestCommand ("Project:lISt" ); c != projectList {
130+ if c , _ := app .BestCommand ("Project:lISt" ); c != projectList {
131131 t .Fatalf ("expected project:list, got %v" , c )
132132 }
133- if c := app .BestCommand ("project:link" ); c != projectLink {
133+ if c , _ := app .BestCommand ("project:link" ); c != projectLink {
134134 t .Fatalf ("expected project:link, got %v" , c )
135135 }
136- if c := app .BestCommand ("project:Link" ); c != projectLink {
136+ if c , _ := app .BestCommand ("project:Link" ); c != projectLink {
137137 t .Fatalf ("expected project:link, got %v" , c )
138138 }
139- if c := app .BestCommand ("foo" ); c != projectList {
139+ if c , _ := app .BestCommand ("foo" ); c != projectList {
140140 t .Fatalf ("expected project:link, got %v" , c )
141141 }
142- if c := app .BestCommand ("FoO" ); c != projectList {
142+ if c , _ := app .BestCommand ("FoO" ); c != projectList {
143143 t .Fatalf ("expected project:link, got %v" , c )
144144 }
145145}
@@ -154,30 +154,36 @@ func TestFuzzyCommandNames(t *testing.T) {
154154 projectLink ,
155155 }
156156
157- c := app .BestCommand ("project:list" )
157+ c , _ := app .BestCommand ("project:list" )
158158 if c != projectList {
159159 t .Fatalf ("expected project:list, got %v" , c )
160160 }
161- c = app .BestCommand ("project:link" )
161+ c , _ = app .BestCommand ("project:link" )
162162 if c != projectLink {
163163 t .Fatalf ("expected project:link, got %v" , c )
164164 }
165- c = app .BestCommand ("pro:list" )
165+ c , _ = app .BestCommand ("pro:list" )
166166 if c != projectList {
167167 t .Fatalf ("expected project:list, got %v" , c )
168168 }
169- c = app .BestCommand ("pro:lis" )
169+ c , _ = app .BestCommand ("pro:lis" )
170170 if c != projectList {
171171 t .Fatalf ("expected project:list, got %v" , c )
172172 }
173- c = app .BestCommand ("p:lis" )
173+ c , _ = app .BestCommand ("p:lis" )
174174 if c != projectList {
175175 t .Fatalf ("expected project:list, got %v" , c )
176176 }
177- c = app .BestCommand ("p:li" )
177+ c , err : = app .BestCommand ("p:li" )
178178 if c != nil {
179179 t .Fatalf ("expected no matches, got %v" , c )
180180 }
181+ if err == nil {
182+ t .Fatal ("expected an error message, got none" )
183+ }
184+ if ! strings .Contains (err .Error (), `Command "p:li" is ambiguous` ) {
185+ t .Fatalf ("error message does not match, got %v" , err .Error ())
186+ }
181187}
182188
183189func TestCommandWithNoNames (t * testing.T ) {
0 commit comments