Search in sources :

Example 16 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testDeletedBUILDFileButLeftPackageInLocalTargets.

@Test
public void testDeletedBUILDFileButLeftPackageInLocalTargets() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("Error:com.google.a.b.Exception exception in Bar: no targets found beneath " + "'tests/com/google/a/b/c/d/baz' Thrown during call: ...");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile()).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo(".blazeproject");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
    assertThat(issue.getMessage()).isEqualTo("no targets found beneath 'tests/com/google/a/b/c/d/baz'");
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 17 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testParseCompileErrorWithColumn.

@Test
public void testParseCompileErrorWithColumn() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("java/com/google/devtools/aswb/pluginrepo/googleplex/PluginsEndpoint.java:33:26: " + "error: '|' is not preceded with whitespace.");
    assertThat(issue).isNotNull();
    assertThat(issue.getLine()).isEqualTo(33);
    assertThat(issue.getColumn()).isEqualTo(26);
    assertThat(issue.getMessage()).isEqualTo("'|' is not preceded with whitespace.");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
    assertThat(issue.getConsoleHyperlinkRange()).isEqualTo(TextRange.create(0, "java/com/google/devtools/aswb/pluginrepo/googleplex/PluginsEndpoint.java:33:26".length()));
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 18 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testParseLinelessBuildError.

@Test
public void testParseLinelessBuildError() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: /path/to/root/java/package_path/BUILD:char offsets 1222--1229: " + "name 'grubber' is not defined");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/path/to/root/java/package_path/BUILD");
    assertThat(issue.getMessage()).isEqualTo("name 'grubber' is not defined");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
    assertThat(issue.getConsoleHyperlinkRange()).isEqualTo(TextRange.create("ERROR: ".length(), "ERROR: /path/to/root/java/package_path/BUILD".length()));
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 19 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testExtraParserMatch.

@Test
public void testExtraParserMatch() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(ImmutableList.of(new TestParser()));
    IssueOutput issue = blazeIssueParser.parseIssue("TEST This is a test message for our test parser.");
    assertThat(issue).isNotNull();
    assertThat(issue.getMessage()).isEqualTo("This is a test message for our test parser.");
    assertThat(issue.getLine()).isEqualTo(-1);
    assertThat(issue.getColumn()).isEqualTo(-1);
    assertThat(issue.getCategory()).isEqualTo(Category.WARNING);
    assertThat(issue.getFile()).isNull();
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 20 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testMultilineTraceback.

@Test
public void testMultilineTraceback() {
    String[] lines = new String[] { "ERROR: /home/plumpy/whatever:9:12: Traceback (most recent call last):", "\tFile \"/path/to/root/java/com/google/android/samples/helloroot/BUILD\", line 8", "\t\tpackage_group(name = BAD_FUNCTION(\"hellogoogle...\"), ...\"])", "\tFile \"/path/to/root/java/com/google/android/samples/helloroot/BUILD\", line 9, " + "in package_group", "\t\tBAD_FUNCTION", "name 'BAD_FUNCTION' is not defined." };
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    for (int i = 0; i < lines.length - 1; ++i) {
        IssueOutput issue = blazeIssueParser.parseIssue(lines[i]);
        assertThat(issue).isNull();
    }
    IssueOutput issue = blazeIssueParser.parseIssue(lines[lines.length - 1]);
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/home/plumpy/whatever");
    assertThat(issue.getMessage().split("\n")).hasLength(lines.length);
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Aggregations

IssueOutput (com.google.idea.blaze.base.scope.output.IssueOutput)27 Test (org.junit.Test)19 Nullable (javax.annotation.Nullable)4 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)3 File (java.io.File)3 List (java.util.List)3 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)2 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)2 ProjectViewFile (com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile)2 ProjectViewParser (com.google.idea.blaze.base.projectview.parser.ProjectViewParser)2 DirectoryEntry (com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry)2 Scope (com.google.idea.blaze.base.scope.Scope)2 BuildSystem (com.google.idea.blaze.base.settings.Blaze.BuildSystem)2 WorkspacePathResolver (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver)2 BlazeValidationError (com.google.idea.blaze.base.ui.BlazeValidationError)2 BlazeValidationResult (com.google.idea.blaze.base.ui.BlazeValidationResult)2 UiUtil (com.google.idea.blaze.base.ui.UiUtil)2 ProjectDataDirectoryValidator (com.google.idea.blaze.base.wizard2.ProjectDataDirectoryValidator)2 Disposable (com.intellij.openapi.Disposable)2 Logger (com.intellij.openapi.diagnostic.Logger)2