Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct error message #63

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions argparse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ func TestIntFailSimple1(t *testing.T) {
i1 := p.Int("f", "flag-arg1", nil)

err := p.Parse(testArgs)
errStr := "[-f|--flag-arg1] bad interger value [string]"
errStr := "[-f|--flag-arg1] bad integer value [string]"
if err == nil || err.Error() != errStr {
t.Errorf("Test %s expected [%s], got [%+v]", t.Name(), errStr, err)
return
Expand Down Expand Up @@ -1155,7 +1155,7 @@ func TestIntListTypeFail(t *testing.T) {
p.IntList("f", "flag-arg1", nil)

err := p.Parse(testArgs)
failureText := "[-f|--flag-arg1] bad interger value [=10]"
failureText := "[-f|--flag-arg1] bad integer value [=10]"
if err == nil || err.Error() != failureText {
t.Errorf("Test %s failed: expected error: [%s], got error: [%+v]", t.Name(), failureText, err)
}
Expand Down
4 changes: 2 additions & 2 deletions argument.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (o *arg) parseInt(args []string, argCount int) error {
default:
val, err := strconv.Atoi(args[0])
if err != nil {
return fmt.Errorf("[%s] bad interger value [%s]", o.name(), args[0])
return fmt.Errorf("[%s] bad integer value [%s]", o.name(), args[0])
}
*o.result.(*int) = val
}
Expand Down Expand Up @@ -273,7 +273,7 @@ func (o *arg) parseIntList(args []string) error {

val, err := strconv.Atoi(args[0])
if err != nil {
return fmt.Errorf("[%s] bad interger value [%s]", o.name(), args[0])
return fmt.Errorf("[%s] bad integer value [%s]", o.name(), args[0])
}
*o.result.(*[]int) = append(*o.result.(*[]int), val)
o.parsed = true
Expand Down