Skip to content

Commit

Permalink
fix test expectations
Browse files Browse the repository at this point in the history
better error message for checkLength
  • Loading branch information
Benjamin Cable committed Mar 16, 2018
1 parent 9d76579 commit 203865d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion validators/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func checkLength(args string, value interface{}) error {
}
count := float64(utf8.RuneCountInString(str))
if count < min || count > max {
return fmt.Errorf("expected a value between %s and %s, but got %s", f64(min), f64(max), f64(count))
return fmt.Errorf("expected string length to be between %s and %s, but got %s", f64(min), f64(max), f64(count))
}
return nil
}
Expand Down
5 changes: 2 additions & 3 deletions validators/validators_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package validators

import (
"fmt"
"math"
"sync"
"testing"
Expand Down Expand Up @@ -822,14 +821,14 @@ func Test_f64(t *testing.T) {
args: args{
f: math.MaxFloat64,
},
want: fmt.Sprint(math.MaxFloat64),
want: "max float64",
},
{
name: "min float",
args: args{
f: -math.MaxFloat64,
},
want: fmt.Sprint(-math.MaxFloat64),
want: "min float64",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 203865d

Please sign in to comment.