Search in sources :

Example 1 with GoCoverageAnnotator

use of com.goide.runconfig.testing.coverage.GoCoverageAnnotator in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoCoverageCalculationTest method testDirectory.

public void testDirectory() throws IOException {
    GoCoverageAnnotator annotator = annotate("coverage.go", "coverage2.go", "withoutHits.go");
    VirtualFile firstFile = myFixture.findFileInTempDir("coverage.go");
    VirtualFile secondFile = myFixture.findFileInTempDir("coverage2.go");
    VirtualFile thirdFile = myFixture.findFileInTempDir("withoutHits.go");
    assertEquals("75% statements", annotator.getFileCoverageInformationString(firstFile));
    assertEquals("83.3% statements", annotator.getFileCoverageInformationString(secondFile));
    assertEquals("0% statements", annotator.getFileCoverageInformationString(thirdFile));
    assertEquals("66.7% files, 72.7% statements", annotator.getDirCoverageInformationString(firstFile.getParent()));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GoCoverageAnnotator(com.goide.runconfig.testing.coverage.GoCoverageAnnotator)

Example 2 with GoCoverageAnnotator

use of com.goide.runconfig.testing.coverage.GoCoverageAnnotator in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoCoverageCalculationTest method annotate.

@NotNull
private GoCoverageAnnotator annotate(@NotNull GoCoverageProjectData data) {
    GoCoverageAnnotator annotator = new GoCoverageAnnotator(myFixture.getProject());
    annotator.annotateAllFiles(data, getRoot());
    return annotator;
}
Also used : GoCoverageAnnotator(com.goide.runconfig.testing.coverage.GoCoverageAnnotator) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with GoCoverageAnnotator

use of com.goide.runconfig.testing.coverage.GoCoverageAnnotator in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoCoverageCalculationTest method testMerging.

public void testMerging() throws IOException {
    VirtualFile file = myFixture.getTempDirFixture().createFile(file());
    GoCoverageProjectData firstData = parseData("coverage.out");
    GoCoverageProjectData secondData = parseData("coverage_for_merge.out");
    GoCoverageAnnotator firstAnnotator = annotate(firstData);
    GoCoverageAnnotator secondAnnotator = annotate(secondData);
    firstData.merge(secondData);
    GoCoverageAnnotator mergeAnnotator = annotate(firstData);
    assertEquals("75% statements", firstAnnotator.getFileCoverageInformationString(file));
    assertEquals("33.3% statements", secondAnnotator.getFileCoverageInformationString(file));
    assertEquals("80% statements", mergeAnnotator.getFileCoverageInformationString(file));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GoCoverageProjectData(com.goide.runconfig.testing.coverage.GoCoverageProjectData) GoCoverageAnnotator(com.goide.runconfig.testing.coverage.GoCoverageAnnotator)

Aggregations

GoCoverageAnnotator (com.goide.runconfig.testing.coverage.GoCoverageAnnotator)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 GoCoverageProjectData (com.goide.runconfig.testing.coverage.GoCoverageProjectData)1 NotNull (org.jetbrains.annotations.NotNull)1