use of java.io.Reader in project buck by facebook.
the class JavaBuckConfigTest method whenJavacExistsAndIsExecutableThenCorrectPathIsReturned.
@Test
public void whenJavacExistsAndIsExecutableThenCorrectPathIsReturned() throws IOException {
Path javac = temporaryFolder.newExecutableFile();
Reader reader = new StringReader(Joiner.on('\n').join("[tools]", " javac = " + javac.toString().replace("\\", "\\\\")));
JavaBuckConfig config = createWithDefaultFilesystem(reader);
assertEquals(Optional.of(javac), config.getJavacPath());
}
use of java.io.Reader in project buck by facebook.
the class JavaBuckConfigTest method whenJavacJarDoesNotExistThenHumanReadableExceptionIsThrown.
@Test
public void whenJavacJarDoesNotExistThenHumanReadableExceptionIsThrown() throws IOException {
String invalidPath = temporaryFolder.getRoot().toAbsolutePath() + "DoesNotExist";
Reader reader = new StringReader(Joiner.on('\n').join("[tools]", " javac_jar = " + invalidPath.replace("\\", "\\\\")));
JavaBuckConfig config = createWithDefaultFilesystem(reader);
try {
config.getJavacJarPath();
fail("Should throw exception as javac file does not exist.");
} catch (HumanReadableException e) {
assertEquals("Overridden tools:javac_jar path not found: " + invalidPath, e.getHumanReadableErrorMessage());
}
}
use of java.io.Reader in project buck by facebook.
the class ParserConfigTest method testGetTrackCellAgnosticTarget.
@Test
public void testGetTrackCellAgnosticTarget() throws IOException {
assertTrue(FakeBuckConfig.builder().build().getView(ParserConfig.class).getTrackCellAgnosticTarget());
Reader reader = new StringReader(Joiner.on('\n').join("[project]", "track_cell_agnostic_target = false"));
ParserConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader).getView(ParserConfig.class);
assertFalse(config.getTrackCellAgnosticTarget());
reader = new StringReader(Joiner.on('\n').join("[project]", "track_cell_agnostic_target = true"));
config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader).getView(ParserConfig.class);
assertTrue(config.getTrackCellAgnosticTarget());
}
use of java.io.Reader in project buck by facebook.
the class ParserConfigTest method testGetBuildFileImportWhitelist.
@Test
public void testGetBuildFileImportWhitelist() throws IOException {
assertTrue(FakeBuckConfig.builder().build().getView(ParserConfig.class).getBuildFileImportWhitelist().isEmpty());
Reader reader = new StringReader(Joiner.on('\n').join("[project]", "build_file_import_whitelist = os, foo"));
ParserConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader).getView(ParserConfig.class);
assertEquals(ImmutableList.of("os", "foo"), config.getBuildFileImportWhitelist());
}
use of java.io.Reader in project buck by facebook.
the class ParserConfigTest method testGetWatchCells.
@Test
public void testGetWatchCells() throws IOException {
assertTrue("watch_cells defaults to true", FakeBuckConfig.builder().build().getView(ParserConfig.class).getWatchCells());
Reader reader = new StringReader(Joiner.on('\n').join("[project]", "watch_cells = false"));
ParserConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader).getView(ParserConfig.class);
assertFalse(config.getWatchCells());
reader = new StringReader(Joiner.on('\n').join("[project]", "watch_cells = true"));
config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader).getView(ParserConfig.class);
assertTrue(config.getWatchCells());
}
Aggregations