Skip to content

Commit 203865d

Browse files
author
Benjamin Cable
committed
fix test expectations
better error message for checkLength
1 parent 9d76579 commit 203865d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

validators/validators.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func checkLength(args string, value interface{}) error {
288288
}
289289
count := float64(utf8.RuneCountInString(str))
290290
if count < min || count > max {
291-
return fmt.Errorf("expected a value between %s and %s, but got %s", f64(min), f64(max), f64(count))
291+
return fmt.Errorf("expected string length to be between %s and %s, but got %s", f64(min), f64(max), f64(count))
292292
}
293293
return nil
294294
}

validators/validators_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package validators
22

33
import (
4-
"fmt"
54
"math"
65
"sync"
76
"testing"
@@ -822,14 +821,14 @@ func Test_f64(t *testing.T) {
822821
args: args{
823822
f: math.MaxFloat64,
824823
},
825-
want: fmt.Sprint(math.MaxFloat64),
824+
want: "max float64",
826825
},
827826
{
828827
name: "min float",
829828
args: args{
830829
f: -math.MaxFloat64,
831830
},
832-
want: fmt.Sprint(-math.MaxFloat64),
831+
want: "min float64",
833832
},
834833
}
835834
for _, tt := range tests {

0 commit comments

Comments
 (0)