aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2016-10-07 16:31:03 +0000
committerGravatar John Cater <jcater@google.com>2016-10-07 17:47:15 +0000
commitb566c7dbf940ba41dc996b1a86eb6ad46ad5a9da (patch)
tree13c9feea59bea2e346f8054ac02ef839a29b6343 /src/test/java/com
parent4f5e12d4978212380fc900b6a7b01e640b85a550 (diff)
Remove support for "Python" parsing mode.
It was unused in Bazel. -- MOS_MIGRATED_REVID=135483937
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java80
1 files changed, 0 insertions, 80 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 e4d8e3b0b0..36ecfe143c 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
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.events.Location;
@@ -58,14 +57,6 @@ public class ParserTest extends EvaluationTestCase {
return parseFileWithComments(input).getStatements();
}
- /** Parses a build code (not Skylark) with PythonProcessing enabled */
- private List<Statement> parseFileWithPython(String... input) {
- return Parser.parseFile(
- ParserInputSource.create(Joiner.on("\n").join(input), null),
- getEventHandler(),
- /*parsePython=*/true).statements;
- }
-
/** Parses Skylark code */
private List<Statement> parseFileForSkylark(String... input) {
return env.parseFile(input);
@@ -902,64 +893,6 @@ public class ParserTest extends EvaluationTestCase {
}
@Test
- public void testFunctionDefinitionIgnoredEvenWithUnsupportedKeyword() throws Exception {
- // Parser skips over entire function definitions without reporting error,
- // when parsePython is set to true.
- List<Statement> stmts = parseFileWithPython(
- "x = 1;",
- "def foo(x, y, **z):",
- " try:",
- " x = 2",
- " with: pass",
- " return 2",
- "x = 3");
- assertThat(stmts).hasSize(2);
- }
-
- @Test
- public void testFunctionDefinitionIgnored() throws Exception {
- // Parser skips over entire function definitions without reporting error,
- // when parsePython is set to true.
- List<Statement> stmts = parseFileWithPython(
- "x = 1;",
- "def foo(x, y, **z):",
- " # a comment",
- " if true:",
- " x = 2",
- " foo(bar)",
- " return z",
- "x = 3");
- assertThat(stmts).hasSize(2);
-
- stmts = parseFileWithPython(
- "x = 1;",
- "def foo(x, y, **z): return x",
- "x = 3");
- assertThat(stmts).hasSize(2);
- }
-
- @Test
- public void testMissingBlock() throws Exception {
- setFailFast(false);
- List<Statement> stmts = parseFileWithPython(
- "x = 1;",
- "def foo(x):",
- "x = 2;\n");
- assertThat(stmts).hasSize(2);
- assertContainsError("expected an indented block");
- }
-
- @Test
- public void testInvalidDef() throws Exception {
- setFailFast(false);
- parseFileWithPython(
- "x = 1;",
- "def foo(x)",
- "x = 2;\n");
- assertContainsError("syntax error at 'EOF'");
- }
-
- @Test
public void testDefSingleLine() throws Exception {
List<Statement> statements = parseFileForSkylark(
"def foo(): x = 1; y = 2\n");
@@ -968,19 +901,6 @@ public class ParserTest extends EvaluationTestCase {
}
@Test
- public void testSkipIfBlock() throws Exception {
- // Skip over 'if' blocks, when parsePython is set
- List<Statement> stmts = parseFileWithPython(
- "x = 1;",
- "if x == 1:",
- " foo(x)",
- "else:",
- " bar(x)",
- "x = 3;\n");
- assertThat(stmts).hasSize(2);
- }
-
- @Test
public void testPass() throws Exception {
List<Statement> statements = parseFileForSkylark("pass\n");
assertThat(statements).isEmpty();