diff options
author | 2018-04-11 04:12:14 -0700 | |
---|---|---|
committer | 2018-04-11 04:13:26 -0700 | |
commit | c381cf17f797f485d7a2df4d085ecbec217c79a9 (patch) | |
tree | d082debc4915d9cacb84ca0ac5b7440832109df6 /src/test/java/com/google/devtools/build/lib/syntax | |
parent | 8a2cd73e1dc6284ba2580f0d1f4c7276e8c1de1b (diff) |
Introduce `--incompatible_disallow_slash_operator` to disable `/` operator.
RELNOTES:
The `/` operator is deprecated in favor of `//` (floor integer division).
Try the `--incompatible_disallow_slash_operator` flag to ensure your code
is forward-compatible.
PiperOrigin-RevId: 192430310
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 8 |
1 files changed, 7 insertions, 1 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 c3c18a9482..c0bd4a46fe 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 @@ -195,8 +195,14 @@ public class EvaluationTest extends EvaluationTestCase { } @Test + public void testSlashOperatorIsForbidden() throws Exception { + newTest("--incompatible_disallow_slash_operator=true") + .testIfErrorContains("The `/` operator has been removed.", "5 / 2"); + } + + @Test public void testDivision() throws Exception { - newTest() + newTest("--incompatible_disallow_slash_operator=false") .testStatement("6 / 2", 3) .testStatement("6 / 4", 1) .testStatement("3 / 6", 0) |