aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
diff options
context:
space:
mode:
authorGravatar laurentlb <laurentlb@google.com>2017-06-14 15:32:41 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-06-14 16:21:03 +0200
commitba69b39468954ed382dc50bc3fc22a1446c5f9d8 (patch)
treef4fcd89bc689644af3ef7e6d644324471861bb71 /src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
parent66c7f75a9abb254b3d204468a8cf58ccfd4d8669 (diff)
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
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java16
1 files changed, 16 insertions, 0 deletions
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')");
+ }
}