-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support file and package exclusions for Scala 3.4.2+
- Loading branch information
Showing
11 changed files
with
126 additions
and
26 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
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
2 changes: 1 addition & 1 deletion
2
src/sbt-test/scoverage/scala3-coverage-excluded-files/build.sbt
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
13 changes: 13 additions & 0 deletions
13
src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt
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,13 @@ | ||
version := "0.1" | ||
|
||
scalaVersion := "3.4.2" | ||
|
||
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test | ||
|
||
coverageExcludedPackages := "two\\..*" | ||
|
||
resolvers ++= { | ||
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT"))) | ||
Seq(Resolver.sonatypeRepo("snapshots")) | ||
else Seq.empty | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/build.properties
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 @@ | ||
sbt.version=1.9.9 |
16 changes: 16 additions & 0 deletions
16
src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/plugins.sbt
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,16 @@ | ||
val pluginVersion = sys.props.getOrElse( | ||
"plugin.version", | ||
throw new RuntimeException( | ||
"""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin | ||
) | ||
) | ||
|
||
addSbtPlugin("org.scoverage" % "sbt-scoverage" % pluginVersion) | ||
|
||
resolvers ++= { | ||
if (pluginVersion.endsWith("-SNAPSHOT")) | ||
Seq(Resolver.sonatypeRepo("snapshots")) | ||
else | ||
Seq.empty | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/GoodCoverage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
object GoodCoverage { | ||
|
||
def sum(num1: Int, num2: Int) = { | ||
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2 | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...bt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/two/GoodCoverage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package two | ||
|
||
object GoodCoverage { | ||
|
||
def sum(num1: Int, num2: Int) = { | ||
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2 | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...bt-test/scoverage/scala3-coverage-excluded-packages/src/test/scala/GoodCoverageSpec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import munit.FunSuite | ||
|
||
/** Created by tbarke001c on 7/8/14. | ||
*/ | ||
class GoodCoverageSpec extends FunSuite { | ||
|
||
test("GoodCoverage should sum two numbers") { | ||
assertEquals(GoodCoverage.sum(1, 2), 3) | ||
assertEquals(GoodCoverage.sum(0, 3), 3) | ||
assertEquals(GoodCoverage.sum(3, 0), 3) | ||
} | ||
|
||
test("two.GoodCoverage should sum two numbers") { | ||
assertEquals(two.GoodCoverage.sum(1, 2), 3) | ||
assertEquals(two.GoodCoverage.sum(0, 3), 3) | ||
assertEquals(two.GoodCoverage.sum(3, 0), 3) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/scoverage/scala3-coverage-excluded-packages/test
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,7 @@ | ||
# run scoverage using the coverage task | ||
> clean | ||
> coverage | ||
> test | ||
> coverageReport | ||
# There should be no directory for the excluded package | ||
-$ exists target/scala-3.4.2/scoverage-report/two |