aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java b/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
index 63d52368a6..f1576ddfb2 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
@@ -19,8 +19,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,16 +45,6 @@ public class PrinterTest {
return EvalUtils.makeSequence(Arrays.<Object>asList(args), true);
}
- private static FilesetEntry makeFilesetEntry() {
- try {
- return new FilesetEntry(Label.parseAbsolute("//foo:bar"),
- Lists.<Label>newArrayList(), Lists.newArrayList("xyz"), "",
- FilesetEntry.SymlinkBehavior.COPY, ".");
- } catch (LabelSyntaxException e) {
- throw new RuntimeException("Bad label: ", e);
- }
- }
-
@Test
public void testPrinter() throws Exception {
// Note that prettyPrintValue and printValue only differ on behaviour of
@@ -94,10 +82,6 @@ public class PrinterTest {
Printer.str(dict));
assertEquals("{1: (\"foo\", \"bar\"), 2: [\"foo\", \"bar\"], \"foo\": []}",
Printer.repr(dict));
- assertEquals("FilesetEntry(srcdir = \"//foo:bar\", files = [], "
- + "excludes = [\"xyz\"], destdir = \"\", "
- + "strip_prefix = \".\", symlinks = \"copy\")",
- Printer.repr(makeFilesetEntry()));
}
private void checkFormatPositionalFails(String errorMessage, String format, Object... arguments) {
@@ -155,51 +139,6 @@ public class PrinterTest {
}
@Test
- public void testFilesetEntrySymlinkAttr() throws Exception {
- FilesetEntry entryDereference =
- createTestFilesetEntry(FilesetEntry.SymlinkBehavior.DEREFERENCE);
-
- assertEquals(
- createExpectedFilesetEntryString(FilesetEntry.SymlinkBehavior.DEREFERENCE, '"'),
- Printer.repr(entryDereference));
- }
-
- private FilesetEntry createStripPrefixFilesetEntry(String stripPrefix) throws Exception {
- Label label = Label.parseAbsolute("//x");
- return new FilesetEntry(
- label,
- Arrays.asList(label),
- Arrays.<String>asList(),
- "",
- FilesetEntry.SymlinkBehavior.DEREFERENCE,
- stripPrefix);
- }
-
- @Test
- public void testFilesetEntryStripPrefixAttr() throws Exception {
- FilesetEntry withoutStripPrefix = createStripPrefixFilesetEntry(".");
- FilesetEntry withStripPrefix = createStripPrefixFilesetEntry("orange");
-
- String prettyWithout = Printer.repr(withoutStripPrefix);
- String prettyWith = Printer.repr(withStripPrefix);
-
- assertThat(prettyWithout).contains("strip_prefix = \".\"");
- assertThat(prettyWith).contains("strip_prefix = \"orange\"");
- }
-
- @Test
- public void testRegressionCrashInPrettyPrintValue() throws Exception {
- // Would cause crash in code such as this:
- // Fileset(name='x', entries=[], out=[FilesetEntry(files=['a'])])
- // While formatting the "expected x, got y" message for the 'out'
- // attribute, prettyPrintValue(FilesetEntry) would be recursively called
- // with a List<Label> even though this isn't a valid datatype in the
- // interpreter.
- // Fileset isn't part of bazel, even though FilesetEntry is.
- assertEquals(createExpectedFilesetEntryString('"'), Printer.repr(createTestFilesetEntry()));
- }
-
- @Test
public void testSingleQuotes() throws Exception {
assertThat(Printer.str("test", '\'')).isEqualTo("test");
assertThat(Printer.repr("test", '\'')).isEqualTo("'test'");
@@ -223,35 +162,5 @@ public class PrinterTest {
.isEqualTo("{1: ('foo', 'bar'), 2: ['foo', 'bar'], 'foo': []}");
assertThat(Printer.repr(dict, '\''))
.isEqualTo("{1: ('foo', 'bar'), 2: ['foo', 'bar'], 'foo': []}");
-
- assertThat(Printer.repr(createTestFilesetEntry(), '\''))
- .isEqualTo(createExpectedFilesetEntryString('\''));
- }
-
- private String createExpectedFilesetEntryString(
- FilesetEntry.SymlinkBehavior symlinkBehavior, char quotationMark) {
- return String.format(
- "FilesetEntry(srcdir = %1$c//x:x%1$c,"
- + " files = [%1$c//x:x%1$c],"
- + " excludes = [],"
- + " destdir = %1$c%1$c,"
- + " strip_prefix = %1$c.%1$c,"
- + " symlinks = %1$c%2$s%1$c)",
- quotationMark, symlinkBehavior.toString().toLowerCase());
- }
-
- private String createExpectedFilesetEntryString(char quotationMark) {
- return createExpectedFilesetEntryString(FilesetEntry.SymlinkBehavior.COPY, quotationMark);
- }
-
- private FilesetEntry createTestFilesetEntry(FilesetEntry.SymlinkBehavior symlinkBehavior)
- throws LabelSyntaxException {
- Label label = Label.parseAbsolute("//x");
- return new FilesetEntry(
- label, Arrays.asList(label), Arrays.<String>asList(), "", symlinkBehavior, ".");
- }
-
- private FilesetEntry createTestFilesetEntry() throws LabelSyntaxException {
- return createTestFilesetEntry(FilesetEntry.SymlinkBehavior.COPY);
}
}