diff options
author | laurentlb <laurentlb@google.com> | 2018-04-11 04:12:14 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-11 04:13:26 -0700 |
commit | c381cf17f797f485d7a2df4d085ecbec217c79a9 (patch) | |
tree | d082debc4915d9cacb84ca0ac5b7440832109df6 /src/test/java/com/google/devtools | |
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')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java | 2 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java index 6c4a34ed92..97983940f5 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java @@ -126,6 +126,7 @@ public class SkylarkSemanticsConsistencyTest { "--incompatible_disable_objc_provider_resources=" + rand.nextBoolean(), "--incompatible_disallow_dict_plus=" + rand.nextBoolean(), "--incompatible_disallow_old_style_args_add=" + rand.nextBoolean(), + "--incompatible_disallow_slash_operator=" + rand.nextBoolean(), "--incompatible_disallow_toplevel_if_statement=" + rand.nextBoolean(), "--incompatible_new_actions_api=" + rand.nextBoolean(), "--incompatible_package_name_is_a_function=" + rand.nextBoolean(), @@ -149,6 +150,7 @@ public class SkylarkSemanticsConsistencyTest { .incompatibleDisableObjcProviderResources(rand.nextBoolean()) .incompatibleDisallowDictPlus(rand.nextBoolean()) .incompatibleDisallowOldStyleArgsAdd(rand.nextBoolean()) + .incompatibleDisallowSlashOperator(rand.nextBoolean()) .incompatibleDisallowToplevelIfStatement(rand.nextBoolean()) .incompatibleNewActionsApi(rand.nextBoolean()) .incompatiblePackageNameIsAFunction(rand.nextBoolean()) 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) |