diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java index 85a8f8c725..9b17d4b9e4 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java @@ -44,6 +44,22 @@ public class ValidationTest extends EvaluationTestCase { } @Test + public void testLoadAfterStatement() throws Exception { + env = newEnvironmentWithSkylarkOptions("--incompatible_bzl_disallow_load_after_statement=true"); + checkError( + "load() statements must be called before any other statement", + "a = 5", + "load(':b.bzl', 'c')"); + } + + @Test + public void testAllowLoadAfterStatement() throws Exception { + env = + newEnvironmentWithSkylarkOptions("--incompatible_bzl_disallow_load_after_statement=false"); + parse("a = 5", "load(':b.bzl', 'c')"); + } + + @Test public void testTwoFunctionsWithTheSameName() throws Exception { checkError( "Variable foo is read only", "def foo():", " return 1", "def foo(x, y):", " return 1"); |