/**
   * Checks if a file from error output can be found.
   *
   * @throws Exception...
   */
  public void testEfsProjectPushPopDirectory() throws Exception {
    String fileName = "testEfsProjectPushPopDirectory.c";

    IProject efsProject =
        ResourceHelper.createCDTProject("EfsProject", new URI("mem:/ProjectPushPopDirectory"));
    ResourceHelper.createFolder(efsProject, "Folder");
    ResourceHelper.createFolder(efsProject, "Folder/SubFolder");
    ResourceHelper.createFile(efsProject, fileName);
    ResourceHelper.createFile(efsProject, "Folder/" + fileName);
    ResourceHelper.createFile(efsProject, "Folder/SubFolder/" + fileName);

    String lines =
        "make[1]: Entering directory `Folder'\n"
            + "make[2]: Entering directory `SubFolder'\n"
            + "make[2]: Leaving directory `SubFolder'\n"
            + fileName
            + ":1:error\n";

    String[] errorParsers = {MAKE_ERRORPARSER_ID, mockErrorParserId};
    parseOutput(efsProject, efsProject.getLocation(), errorParsers, lines);
    assertEquals(1, errorList.size());

    ProblemMarkerInfo problemMarkerInfo = errorList.get(0);
    assertEquals("L/EfsProject/Folder/" + fileName, problemMarkerInfo.file.toString());
    assertEquals(1, problemMarkerInfo.lineNumber);
    assertEquals("error", problemMarkerInfo.description);
  }
  /**
   * Checks if a file from error output can be found.
   *
   * @throws Exception...
   */
  public void testEfsProjectBuildDirURI() throws Exception {
    String fileName = "testEfsProjectBuildDirURI.c";

    IProject efsProject = ResourceHelper.createCDTProject("EfsProject", new URI("mem:/EfsProject"));
    ResourceHelper.createFolder(efsProject, "Folder");
    ResourceHelper.createFile(efsProject, "Folder/" + fileName);
    ResourceHelper.createFolder(efsProject, "BuildDir");
    ResourceHelper.createFile(efsProject, "BuildDir/" + fileName);

    URI buildDirURI = new URI("mem:/EfsProject/BuildDir/");
    parseOutput(efsProject, buildDirURI, new String[] {mockErrorParserId}, fileName + ":1:error");
    assertEquals(1, errorList.size());

    ProblemMarkerInfo problemMarkerInfo = errorList.get(0);
    assertEquals("L/EfsProject/BuildDir/" + fileName, problemMarkerInfo.file.toString());
    assertEquals("error", problemMarkerInfo.description);
  }
  /**
   * Checks if a file from error output can be found.
   *
   * @throws Exception...
   */
  public void testInNonEfsFolder() throws Exception {
    ResourceHelper.createFolder(fProject, "NonEfsFolder");
    ResourceHelper.createEfsFile(
        fProject, "NonEfsFolder/testInNonEfsFolder.c", "null:/EfsFolder/efsTestInNonEfsFolder.c");

    parseOutput("efsTestInNonEfsFolder.c:1:error");
    assertEquals(1, errorList.size());

    ProblemMarkerInfo problemMarkerInfo = errorList.get(0);
    assertEquals(
        "L/FindMatchingFilesEfsTest/NonEfsFolder/testInNonEfsFolder.c",
        problemMarkerInfo.file.toString());
    assertEquals("error", problemMarkerInfo.description);
  }
  /**
   * Checks if a file from error output can be found.
   *
   * @throws Exception...
   */
  public void testEfsProject() throws Exception {
    IFile efsSmokeTest =
        ResourceHelper.createEfsFile(fProject, "efsSmokeTest.c", "mem:/efsSmokeTest.c");
    Assert.assertTrue(efsSmokeTest.exists());

    IProject efsProject = ResourceHelper.createCDTProject("EfsProject", new URI("mem:/EfsProject"));
    ResourceHelper.createFolder(efsProject, "Folder");
    ResourceHelper.createFile(efsProject, "Folder/testEfsProject.c");

    parseOutput(efsProject, "testEfsProject.c:1:error");
    assertEquals(1, errorList.size());

    ProblemMarkerInfo problemMarkerInfo = errorList.get(0);
    assertEquals("L/EfsProject/Folder/testEfsProject.c", problemMarkerInfo.file.toString());
    assertEquals("error", problemMarkerInfo.description);
  }
Beispiel #5
0
 /**
  * Creates new file from project root with empty content. The filename can include relative path
  * as a part of the name but the the path has to be present on disk.
  *
  * @param project - project where to create the file.
  * @param name - filename.
  * @return file handle.
  * @throws CoreException if something goes wrong.
  */
 public static IFile createFile(IProject project, String name) throws CoreException {
   if (new Path(name).segmentCount() > 1)
     createFolder(project, new Path(name).removeLastSegments(1).toString());
   return createFile(project.getFile(name), null);
 }