Skip to content

Commit 6290186

Browse files
fix(test): Fix strings.Repeat test that failed in the wrong way on 32bit (#2129)
Signed-off-by: Dave Henderson <[email protected]>
1 parent a9fe2e5 commit 6290186

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/tests/integration/strings_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package integration
22

33
import (
4+
"fmt"
5+
"math"
46
"strings"
57
"testing"
68

@@ -26,7 +28,10 @@ func TestStrings_Indent(t *testing.T) {
2628
func TestStrings_Repeat(t *testing.T) {
2729
inOutTest(t, `ba{{ strings.Repeat 2 "na" }}`, `banana`)
2830

29-
_, _, err := cmd(t, "-i", `ba{{ strings.Repeat 9223372036854775807 "na" }}`).run()
31+
// use MaxInt so we avoid a negative count on 32-bit systems
32+
input := fmt.Sprintf(`ba{{ strings.Repeat %d "na" }}`, math.MaxInt)
33+
34+
_, _, err := cmd(t, "-i", input).run()
3035
assert.ErrorContains(t, err, `too long: causes overflow`)
3136

3237
_, _, err = cmd(t, "-i", `ba{{ strings.Repeat -1 "na" }}`).run()

0 commit comments

Comments
 (0)