-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from tcnksm/fix-flag-with-dash
Fix flag with dash
- Loading branch information
Showing
30 changed files
with
274 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package skeleton | ||
|
||
import "testing" | ||
import "reflect" | ||
|
||
func TestCommand_Fix(t *testing.T) { | ||
tests := []struct { | ||
in, exp *Command | ||
success bool | ||
}{ | ||
{ | ||
in: &Command{ | ||
Name: "server-start", | ||
Flags: []Flag{}, | ||
}, | ||
|
||
exp: &Command{ | ||
Name: "server-start", | ||
FunctionName: "serverStart", | ||
Flags: []Flag{}, | ||
}, | ||
|
||
success: true, | ||
}, | ||
} | ||
|
||
for i, tt := range tests { | ||
|
||
err := tt.in.Fix() | ||
if err != nil && !tt.success { | ||
continue | ||
} | ||
|
||
if err == nil && !tt.success { | ||
t.Fatalf("#%d expect Fix to fail", i) | ||
} | ||
|
||
if err != nil { | ||
t.Fatalf("#%d expect Fix not to fail but %q", i, err.Error()) | ||
} | ||
|
||
if !reflect.DeepEqual(*tt.in, *tt.exp) { | ||
t.Errorf("#%d expect %v to eq %v", i, tt.in, tt.exp) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.