diff options
author | alandonovan <adonovan@google.com> | 2021-01-13 21:12:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 21:12:56 -0500 |
commit | 8756d3ec17702f93b2d5e50e9ea6762f30bec167 (patch) | |
tree | f40669476fbeaf36a0d22d0551334fe0ca73d2bf | |
parent | e81fc95f7bd5bb1495fe69f27c1a99fcc77caa48 (diff) | |
download | starlark-go-8756d3ec17702f93b2d5e50e9ea6762f30bec167.tar.gz |
starlark: avoid constants > 1<<32 in tests (#336)
...so that they compile on 32-bit platforms like GOARCH=386.
-rw-r--r-- | starlark/eval_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/starlark/eval_test.go b/starlark/eval_test.go index 81f8c58..309a5b1 100644 --- a/starlark/eval_test.go +++ b/starlark/eval_test.go @@ -721,8 +721,9 @@ func TestAsInt(t *testing.T) { }{ {starlark.MakeInt(42), new(int32), "42"}, {starlark.MakeInt(-1), new(int32), "-1"}, - {starlark.MakeInt(1 << 40), new(int32), "1099511627776 out of range (want value in signed 32-bit range)"}, - {starlark.MakeInt(-1 << 40), new(int32), "-1099511627776 out of range (want value in signed 32-bit range)"}, + // Use Lsh not 1<<40 as the latter exceeds int if GOARCH=386. + {starlark.MakeInt(1).Lsh(40), new(int32), "1099511627776 out of range (want value in signed 32-bit range)"}, + {starlark.MakeInt(-1).Lsh(40), new(int32), "-1099511627776 out of range (want value in signed 32-bit range)"}, {starlark.MakeInt(42), new(uint16), "42"}, {starlark.MakeInt(0xffff), new(uint16), "65535"}, |