Search in sources :

Example 1 with GoCoverageProjectData

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

the class GoCoverageCalculationTest method parseData.

@NotNull
private GoCoverageProjectData parseData(@NotNull String coverageSource) throws IOException {
    try (BufferedReader reader = new BufferedReader(new FileReader(new File(getTestDataPath(), coverageSource)))) {
        GoCoverageProjectData data = GoCoverageRunner.parseCoverage(reader, myFixture.getProject(), myModule);
        assertNotNull(data);
        return data;
    }
}
Also used : GoCoverageProjectData(com.goide.runconfig.testing.coverage.GoCoverageProjectData) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with GoCoverageProjectData

use of com.goide.runconfig.testing.coverage.GoCoverageProjectData 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

GoCoverageProjectData (com.goide.runconfig.testing.coverage.GoCoverageProjectData)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 GoCoverageAnnotator (com.goide.runconfig.testing.coverage.GoCoverageAnnotator)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 NotNull (org.jetbrains.annotations.NotNull)1