diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2024-06-23 19:23:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-23 19:23:26 -0400 |
| commit | 62901868f10e887f602e85b37eac70c77f864cc4 (patch) | |
| tree | bf074ba8f22f5446727e3fb8b26d210b87b46025 | |
| parent | a9fe2e5e6ee3c290c3f1ba2675b8f601488641b9 (diff) | |
fix(test): Fix strings.Repeat test that failed in the wrong way on 32bit (#2129)
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
| -rw-r--r-- | internal/tests/integration/strings_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/tests/integration/strings_test.go b/internal/tests/integration/strings_test.go index 27ffafe8..82a39d14 100644 --- a/internal/tests/integration/strings_test.go +++ b/internal/tests/integration/strings_test.go @@ -1,6 +1,8 @@ package integration import ( + "fmt" + "math" "strings" "testing" @@ -26,7 +28,10 @@ func TestStrings_Indent(t *testing.T) { func TestStrings_Repeat(t *testing.T) { inOutTest(t, `ba{{ strings.Repeat 2 "na" }}`, `banana`) - _, _, err := cmd(t, "-i", `ba{{ strings.Repeat 9223372036854775807 "na" }}`).run() + // use MaxInt so we avoid a negative count on 32-bit systems + input := fmt.Sprintf(`ba{{ strings.Repeat %d "na" }}`, math.MaxInt) + + _, _, err := cmd(t, "-i", input).run() assert.ErrorContains(t, err, `too long: causes overflow`) _, _, err = cmd(t, "-i", `ba{{ strings.Repeat -1 "na" }}`).run() |
