diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java index 2ae31358cb..5e9391f54e 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java @@ -217,6 +217,18 @@ public class EvaluationTest extends EvaluationTestCase { } @Test + public void testCheckedArithmetic() throws Exception { + new SkylarkTest("--incompatible_checked_arithmetic=true") + .testIfErrorContains("integer overflow", "2000000000 + 2000000000") + .testIfErrorContains("integer overflow", "1234567890 * 987654321") + .testIfErrorContains("integer overflow", "- 2000000000 - 2000000000") + + // literal 2147483648 is not allowed, so we compute it + .setUp("minint = - 2147483647 - 1") + .testIfErrorContains("integer overflow", "-minint"); + } + + @Test public void testOperatorPrecedence() throws Exception { newTest() .testStatement("2 + 3 * 4", 14) |