-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for -coverage-exclude-classlikes and -coverage-exclude-fi…
…les for Scala 3
- Loading branch information
Showing
8 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/functionalTest/java/org/scoverage/ScalaSingleModuleTestScala3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.scoverage; | ||
|
||
import org.junit.Assert; | ||
|
||
import java.util.List; | ||
|
||
public class ScalaSingleModuleTestScala3 extends ScalaSingleModuleTest { | ||
|
||
@Override | ||
protected List<String> getVersionAgruments() { | ||
return ScalaVersionArguments.version3; | ||
} | ||
|
||
@Override | ||
public void checkScoverage() throws Exception { | ||
AssertableBuildResult result = run("clean", ScoveragePlugin.getCHECK_NAME()); | ||
|
||
result.assertTaskSucceeded(ScoveragePlugin.getCOMPILE_NAME()); | ||
result.assertTaskSucceeded(ScoveragePlugin.getREPORT_NAME()); | ||
result.assertTaskSucceeded(ScoveragePlugin.getCHECK_NAME()); | ||
result.assertTaskDoesntExist(ScoveragePlugin.getAGGREGATE_NAME()); | ||
|
||
assertReportFilesExist(); | ||
assertCoverage(66.67); | ||
} | ||
|
||
@Override | ||
public void reportScoverageWithExcludedClasses() throws Exception { | ||
AssertableBuildResult result = run("clean", ScoveragePlugin.getREPORT_NAME(), | ||
"-PexcludedFile=.*"); | ||
|
||
result.assertTaskSucceeded(ScoveragePlugin.getCOMPILE_NAME()); | ||
result.assertTaskSucceeded(ScoveragePlugin.getREPORT_NAME()); | ||
result.assertTaskDoesntExist(ScoveragePlugin.getCHECK_NAME()); | ||
result.assertTaskDoesntExist(ScoveragePlugin.getAGGREGATE_NAME()); | ||
|
||
Assert.assertTrue(resolve(reportDir(), "index.html").exists()); | ||
Assert.assertFalse(resolve(reportDir(), "org/hello/World.scala.html").exists()); | ||
assertCoverage(100.0); // coverage is 100 since no classes are covered | ||
|
||
// compiled class should exist in the default classes directory, but not in scoverage | ||
Assert.assertTrue(resolve(buildDir(), "classes/scala/main/org/hello/World.class").exists()); | ||
} | ||
|
||
@Override | ||
public void reportScoverageWithoutNormalCompilationAndWithExcludedClasses() throws Exception { | ||
AssertableBuildResult result = run("clean", ScoveragePlugin.getREPORT_NAME(), | ||
"-PexcludedFile=.*", "-P" + ScoveragePlugin.getSCOVERAGE_COMPILE_ONLY_PROPERTY()); | ||
|
||
Assert.assertTrue(resolve(reportDir(), "index.html").exists()); | ||
Assert.assertFalse(resolve(reportDir(), "org/hello/World.scala.html").exists()); | ||
assertCoverage(100.0); // coverage is 100 since no classes are covered | ||
|
||
// compiled class should exist in the default classes directory, but not in scoverage | ||
Assert.assertTrue(resolve(buildDir(), "classes/scala/main/org/hello/World.class").exists()); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/functionalTest/java/org/scoverage/ScalaVersionArguments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.scoverage; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public interface ScalaVersionArguments { | ||
List<String> version2 = Arrays.asList( | ||
"-PscalaVersionMajor=2", | ||
"-PscalaVersionMinor=13", | ||
"-PscalaVersionBuild=14", | ||
"-PjunitVersion=5.3.2", | ||
"-PjunitPlatformVersion=1.3.2", | ||
"-PscalatestVersion=3.2.16" | ||
); | ||
|
||
List<String> version3 = Arrays.asList( | ||
"-PscalaVersionMajor=3", | ||
"-PscalaVersionMinor=4", | ||
"-PscalaVersionBuild=2", | ||
"-PjunitVersion=5.3.2", | ||
"-PjunitPlatformVersion=1.3.2", | ||
"-PscalatestVersion=3.2.16" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...st/resources/projects/scala-single-module/src/test/scala/org/hello/TestNothingSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...onalTest/resources/projects/scala-single-module/src/test/scala/org/hello/WorldSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters