aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-09-03 17:49:57 +0000
committerGravatar David Chen <dzc@google.com>2015-09-03 22:17:14 +0000
commit2c3b120a26612c5ad4856c043e888468b39a5f46 (patch)
tree8f0851039f79d60e6213f4ffc660da687db23fe8 /src/test/java
parent4226be2ddaf265c1eba70f28e0ed1d9578cf6690 (diff)
Remove unused ParserInputSource method and other minor cleanups
Trying to curb usage of the create method taking a String for efficiency reasons. Noticed this method was unused + a few places where we could easily use chars instead of string. Not a major improvement but removes some temptation. RELNOTES: -- MOS_MIGRATED_REVID=102258319
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/ParserInputSourceTest.java37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ParserInputSourceTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ParserInputSourceTest.java
index 0cb60798a0..9fe72815c2 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ParserInputSourceTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ParserInputSourceTest.java
@@ -26,9 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
@@ -67,17 +65,6 @@ public class ParserInputSourceTest {
assertEquals(pathName, input.getPath().toString());
}
- @Test
- public void testCreateFromInputStream() throws IOException {
- String content = "Content provided as a string.";
- byte[] bytes = content.getBytes("ISO-8859-1");
- ByteArrayInputStream in = new ByteArrayInputStream(bytes);
- String pathName = "/the/name/of/the/content.txt";
- Path path = scratch.resolve(pathName);
- ParserInputSource input = ParserInputSource.create(in, path);
- assertEquals(content, new String(input.getContent()));
- assertEquals(pathName, input.getPath().toString());
- }
@Test
public void testIOExceptionIfInputFileDoesNotExistForSingleArgConstructor() {
@@ -102,28 +89,4 @@ public class ParserInputSourceTest {
char[] content = "Content provided as char array.".toCharArray();
ParserInputSource.create(content, new PathFragment("/will/not/try/to/read"));
}
-
- @Test
- public void testWillCloseStreamWhenReadingFromInputStream() {
- final StringBuilder log = new StringBuilder();
- InputStream in = new InputStream() {
- @Override
- public int read() throws IOException {
- throw new IOException("Fault injected.");
- }
- @Override
- public void close() {
- log.append("Stream closed.");
- }
- };
- try {
- Path path = scratch.resolve("/will/not/try/to/read");
- ParserInputSource.create(in, path);
- fail();
- } catch (IOException e) {
- assertThat(e).hasMessage("Fault injected.");
- }
- assertEquals("Stream closed.", log.toString());
- }
-
}