@@ -112,6 +112,38 @@ func TestCommand_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) {
112112 }
113113}
114114
115+ func TestCaseInsensitiveCommandNames (t * testing.T ) {
116+ app := Application {}
117+ app .ErrWriter = io .Discard
118+ projectList := & Command {Name : "project:LIST" , Aliases : []* Alias {{Name : "FOO" }}}
119+ projectLink := & Command {Name : "PROJECT:link" }
120+ app .Commands = []* Command {
121+ projectList ,
122+ projectLink ,
123+ }
124+
125+ app .setup ()
126+
127+ if c := app .BestCommand ("project:list" ); c != projectList {
128+ t .Fatalf ("expected project:list, got %v" , c )
129+ }
130+ if c := app .BestCommand ("Project:lISt" ); c != projectList {
131+ t .Fatalf ("expected project:list, got %v" , c )
132+ }
133+ if c := app .BestCommand ("project:link" ); c != projectLink {
134+ t .Fatalf ("expected project:link, got %v" , c )
135+ }
136+ if c := app .BestCommand ("project:Link" ); c != projectLink {
137+ t .Fatalf ("expected project:link, got %v" , c )
138+ }
139+ if c := app .BestCommand ("foo" ); c != projectList {
140+ t .Fatalf ("expected project:link, got %v" , c )
141+ }
142+ if c := app .BestCommand ("FoO" ); c != projectList {
143+ t .Fatalf ("expected project:link, got %v" , c )
144+ }
145+ }
146+
115147func TestFuzzyCommandNames (t * testing.T ) {
116148 app := Application {}
117149 app .ErrWriter = io .Discard
0 commit comments