Skip to content

Commit

Permalink
Duplicate scala3 coverage excluded tests for scala 3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
a-morales authored and ckipp01 committed Oct 10, 2024
1 parent 1c79840 commit 67f5157
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version := "0.1"

scalaVersion := "3.3.4"

libraryDependencies += "org.scalameta" %% "munit" % "1.0.1" % Test

coverageExcludedFiles := ".*\\/two\\/GoodCoverage;.*\\/three\\/.*"

resolvers ++= {
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT")))
Resolver.sonatypeOssRepos("snapshots")
else Seq.empty
}
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
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package three

object GoodCoverage {

def sum(num1: Int, num2: Int) = {
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
}

}
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
}

}
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)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# run scoverage using the coverage task
> clean
> coverage
> test
> coverageReport
# There should be no directory for the excluded files
$ exists target/scala-3.3.4/scoverage-report/GoodCoverage.scala.html
-$ exists target/scala-3.3.4/scoverage-report/two
-$ exists target/scala-3.3.4/scoverage-report/three
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version := "0.1"

scalaVersion := "3.3.4"

libraryDependencies += "org.scalameta" %% "munit" % "1.0.1" % Test

coverageExcludedPackages := "two\\..*;three\\..*"

resolvers ++= {
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT")))
Resolver.sonatypeOssRepos("snapshots")
else Seq.empty
}
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
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package three

object GoodCoverage {

def sum(num1: Int, num2: Int) = {
if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
}

}
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
}

}
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)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# run scoverage using the coverage task
> clean
> coverage
> test
> coverageReport
# There should be no directory for the excluded package
$ exists target/scala-3.3.4/scoverage-report/GoodCoverage.scala.html
-$ exists target/scala-3.3.4/scoverage-report/two
-$ exists target/scala-3.3.4/scoverage-report/three

0 comments on commit 67f5157

Please sign in to comment.