use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class BuildCommandIntegrationTest method buckBuildAndCopyOutputFileWithBuildTargetThatSupportsIt.
@Test
public void buckBuildAndCopyOutputFileWithBuildTargetThatSupportsIt() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "build_into", tmp);
workspace.setUp();
Path externalOutputs = tmp.newFolder("into-output");
Path output = externalOutputs.resolve("the_example.jar");
assertFalse(output.toFile().exists());
workspace.runBuckBuild("//:example", "--out", output.toString()).assertSuccess();
assertTrue(output.toFile().exists());
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("com/example/Example.class");
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AuditAliasCommandIntegrationTest method testBuckAliasList.
@Test
public void testBuckAliasList() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "alias", tmp);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("audit", "alias", "--list");
result.assertSuccess();
// Remove trailing newline from stdout before passing to Splitter.
String stdout = result.getStdout();
assertTrue(stdout.endsWith("\n"));
stdout = stdout.substring(0, stdout.length() - 1);
List<String> aliases = Splitter.on('\n').splitToList(stdout);
assertEquals("Aliases that appear in both .buckconfig and .buckconfig.local should appear only once.", 3, aliases.size());
assertEquals(ImmutableSet.of("foo", "bar", "bar_ex"), ImmutableSet.copyOf(aliases));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AuditConfigCommandIntegrationTest method testConfigJsonUIWithWholeSection.
@Test
public void testConfigJsonUIWithWholeSection() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_config", tmp);
workspace.setUp();
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("audit", "config", "--json", "missing_section.badvalue", "ignored_section");
result.assertSuccess();
assertEquals(workspace.getFileContents("stdout-config.json").trim(), result.getStdout());
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AuditConfigCommandIntegrationTest method testErrorOnBothTabAndJson.
@Test
public void testErrorOnBothTabAndJson() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_config", tmp);
workspace.setUp();
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("audit", "config", "--tab", "--json", "missing_section.badvalue", "ignored_section", "ignored_section.dotted.value", "second_section.some_property", "ignored_section.short_value", "ignored_section.long_value");
result.assertFailure();
assertThat(result.getStderr(), containsString("--json and --tab cannot both be specified"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AuditConfigCommandIntegrationTest method testTabbedUI.
@Test
public void testTabbedUI() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_config", tmp);
workspace.setUp();
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("audit", "config", "--tab", "missing_section.badvalue", "ignored_section.dotted.value", "ignored_section.short_value", "ignored_section.long_value");
result.assertSuccess();
assertEquals(workspace.getFileContents("stdout-config"), result.getStdout());
}
Aggregations