From ba69b39468954ed382dc50bc3fc22a1446c5f9d8 Mon Sep 17 00:00:00 2001 From: laurentlb Date: Wed, 14 Jun 2017 15:32:41 +0200 Subject: Introduce --incompatible_load_argument_is_label (1st argument of load must be a label). RELNOTES: First argument of 'load' should be a label. Path syntax is deprecated (label should start with '//' or ':'). PiperOrigin-RevId: 158971314 --- .../devtools/build/lib/syntax/SkylarkEvaluationTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java') diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java index 81fa580ecb..ba6fd69add 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java @@ -1520,4 +1520,20 @@ public class SkylarkEvaluationTest extends EvaluationTest { eval("def foo():", " a = 10", " b = [a for a in range(3)]", " return a", "x = foo()"); assertThat(lookup("x")).isEqualTo(2); } + + @Test + public void testLoadStatementWithAbsolutePath() throws Exception { + env = newEnvironmentWithSkylarkOptions("--incompatible_load_argument_is_label"); + checkEvalErrorContains( + "First argument of 'load' must be a label and start with either '//' or ':'", + "load('/tmp/foo', 'arg')"); + } + + @Test + public void testLoadStatementWithRelativePath() throws Exception { + env = newEnvironmentWithSkylarkOptions("--incompatible_load_argument_is_label"); + checkEvalErrorContains( + "First argument of 'load' must be a label and start with either '//' or ':'", + "load('foo', 'arg')"); + } } -- cgit v1.2.3