use of java.io.Reader in project buck by facebook.
the class BuckConfigTest method testGetBuildTargetListResolvesAliases.
@Test
public void testGetBuildTargetListResolvesAliases() throws IOException, NoSuchBuildTargetException {
Reader reader = new StringReader(Joiner.on('\n').join("[alias]", "foo = //java/com/example:foo", "[section]", "some_list = \\", "foo, \\", "//java/com/example:bar"));
BuckConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader);
ImmutableList<String> expected = ImmutableList.of("//java/com/example:foo", "//java/com/example:bar");
ImmutableList<String> result = ImmutableList.copyOf(FluentIterable.from(config.getBuildTargetList("section", "some_list")).transform(Object::toString));
assertThat(result, Matchers.equalTo(expected));
}
use of java.io.Reader in project buck by facebook.
the class BuckConfigTest method testExcludedLabels.
@Test
public void testExcludedLabels() throws IOException {
Reader reader = new StringReader(Joiner.on('\n').join("[test]", "excluded_labels = windows, linux"));
BuckConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader);
assertEquals(ImmutableList.of("windows", "linux"), config.getDefaultRawExcludedLabelSelectors());
}
use of java.io.Reader in project buck by facebook.
the class InstallCommandOptionsTest method getAdbOptions.
private AdbOptions getAdbOptions(boolean multiInstallModeConfig, String... args) throws CmdLineException, IOException {
Reader reader = new StringReader(Joiner.on('\n').join("[adb]", "multi_install_mode = " + multiInstallModeConfig));
BuckConfig config = BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader);
return getCommand(args).adbOptions(config);
}
use of java.io.Reader in project buck by facebook.
the class RawConfigTest method entriesAreStoredInFileOrder.
@Test
public void entriesAreStoredInFileOrder() throws Exception {
Reader reader = new StringReader(Joiner.on('\n').join("[alias]", "one = //foo:one", "two = //foo:two", "three = //foo:three", "four = //foo:four"));
RawConfig rawConfig = RawConfig.builder().putAll(Inis.read(reader)).build();
assertThat("entries are sorted in the order that they appear in the file", rawConfig.getSection("alias").keySet(), contains("one", "two", "three", "four"));
}
use of java.io.Reader in project buck by facebook.
the class JavaBuckConfigTest method whenJavacIsNotExecutableThenHumanReadableExeceptionIsThrown.
@Test
public void whenJavacIsNotExecutableThenHumanReadableExeceptionIsThrown() throws IOException {
assumeThat("Files on Windows are executable by default.", Platform.detect(), is(not(Platform.WINDOWS)));
Path javac = temporaryFolder.newFile();
Reader reader = new StringReader(Joiner.on('\n').join("[tools]", " javac = " + javac.toString()));
JavaBuckConfig config = createWithDefaultFilesystem(reader);
try {
config.getJavacPath();
fail("Should throw exception as javac file is not executable.");
} catch (HumanReadableException e) {
assertEquals(e.getHumanReadableErrorMessage(), "javac is not executable: " + javac);
}
}
Aggregations