Search in sources :

Example 6 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult 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));
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 7 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class AuditDependenciesCommandIntegrationTest method testJSONOutput.

@Test
public void testJSONOutput() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_dependencies", tmp);
    workspace.setUp();
    // Print all of the inputs to the rule.
    ProcessResult result = workspace.runBuckCommand("audit", "dependencies", "--json", "//example:one");
    result.assertSuccess();
    assertEquals(workspace.getFileContents("stdout-one.json"), result.getStdout());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 8 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class AuditDependenciesCommandIntegrationTest method testTestsThatArentNecessarilyIncludedInOriginalParseAreIncludedInOutput.

@Test
public void testTestsThatArentNecessarilyIncludedInOriginalParseAreIncludedInOutput() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_dependencies", tmp);
    workspace.setUp();
    // Print all of the inputs to the rule.
    ProcessResult result = workspace.runBuckCommand("audit", "dependencies", "--include-tests", "--transitive", "//lib/lib1:lib1");
    result.assertSuccess();
    assertEquals(workspace.getFileContents("stdout-lib1-transitive-tests"), result.getStdout());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 9 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class AuditDependenciesCommandIntegrationTest method testThatJSONOutputWithMultipleInputsIsGroupedByInput.

@Test
public void testThatJSONOutputWithMultipleInputsIsGroupedByInput() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_dependencies", tmp);
    workspace.setUp();
    // Print all of the inputs to the rule.
    ProcessResult result = workspace.runBuckCommand("audit", "dependencies", "--json", "//example:two", "//example:three");
    result.assertSuccess();
    assertEquals(workspace.getFileContents("stdout-two-three.json"), result.getStdout());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 10 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class AuditDependenciesCommandIntegrationTest method testThatTransitiveJSONOutputWithMultipleInputsIsGroupedByInput.

@Test
public void testThatTransitiveJSONOutputWithMultipleInputsIsGroupedByInput() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_dependencies", tmp);
    workspace.setUp();
    // Print all of the inputs to the rule.
    ProcessResult result = workspace.runBuckCommand("audit", "dependencies", "--transitive", "--json", "//example:one", "//example:two", "//example:three");
    result.assertSuccess();
    assertEquals(workspace.getFileContents("stdout-one-two-three-transitive.json"), result.getStdout());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Aggregations

ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)175 Test (org.junit.Test)174 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)127 Path (java.nio.file.Path)21 Matchers.containsString (org.hamcrest.Matchers.containsString)20 BuildTarget (com.facebook.buck.model.BuildTarget)17 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TestContext (com.facebook.buck.testutil.integration.TestContext)4 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)3 ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)3 ZipFile (java.util.zip.ZipFile)3 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)2 DelegatingInputStream (com.facebook.buck.testutil.integration.DelegatingInputStream)2 CapturingPrintStream (com.facebook.buck.util.CapturingPrintStream)2 File (java.io.File)2 Charset (java.nio.charset.Charset)2 FileTime (java.nio.file.attribute.FileTime)2 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1