diff options
author | 2016-10-26 10:59:09 +0000 | |
---|---|---|
committer | 2016-10-26 11:11:22 +0000 | |
commit | a3c25a6ce14156bad75f9fd971ffc58320d28c9f (patch) | |
tree | e040081d01f4b501218ae19030e70a7dce2ad9e3 /src/test/java/com/google/devtools/build/lib/syntax | |
parent | b25a03452fa414660ea2f326e3d2b2c06c1ca548 (diff) |
Cleanup in the parser
- Move break/continue check from ValidationEnvironment to the Parser
- Remove some differences between BUILD / Skylark parsing mode
- Fix location off-by-one error in the break/continue tokens
- Remove duplicated error message ('for loops are not allowed on top-level')
--
MOS_MIGRATED_REVID=137259929
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java | 4 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java | 5 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java index e90f2421aa..f20157a782 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java @@ -518,10 +518,10 @@ public class ParserTest extends EvaluationTestCase { assertThat(loop).hasSize(3); assertThat(((FlowStatement) loop.get(0)).getKind()).isEqualTo(FlowStatement.Kind.BREAK); - assertLocation(34, 40, loop.get(0).getLocation()); + assertLocation(34, 39, loop.get(0).getLocation()); assertThat(((FlowStatement) loop.get(1)).getKind()).isEqualTo(FlowStatement.Kind.CONTINUE); - assertLocation(44, 53, loop.get(1).getLocation()); + assertLocation(44, 52, loop.get(1).getLocation()); assertThat(((FlowStatement) loop.get(2)).getKind()).isEqualTo(FlowStatement.Kind.BREAK); assertLocation(57, 62, loop.get(2).getLocation()); 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 7acaaa7723..6152cbe78a 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 @@ -39,11 +39,6 @@ public class ValidationTest extends EvaluationTestCase { } @Test - public void testTopLevelForStatement() throws Exception { - checkError("'For' is not allowed as a top level statement", "for i in [1,2,3]: a = i\n"); - } - - @Test public void testReturnOutsideFunction() throws Exception { checkError("Return statements must be inside a function", "return 2\n"); } |