Skip to content

Add Scala 2.13.0-RC1 support #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ scala:
- 2.10.7
- 2.11.12
- 2.12.8
- 2.13.0-M5
- 2.13.0-RC1

before_cache:
- find "$HOME/.sbt/" -name '*.lock' -print0 | xargs -0 rm
Expand Down
11 changes: 8 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import sbtcrossproject.CrossProject
import sbtcrossproject.CrossType

val Org = "org.scoverage"
val ScalatestVersion = "3.0.6-SNAP4"
val ScalatestVersion = "3.0.8-RC2"

val appSettings = Seq(
organization := Org,
scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.8", "2.13.0-M5"),
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.8", "2.13.0-RC1"),
fork in Test := false,
publishMavenStyle := true,
publishArtifact in Test := false,
Expand Down Expand Up @@ -43,6 +43,11 @@ val appSettings = Seq(
<name>Stephen Samuel</name>
<url>http://github.com/sksamuel</url>
</developer>
<developer>
<id>gslowikowski</id>
<name>Grzegorz Slowikowski</name>
<url>http://github.com/gslowikowski</url>
</developer>
</developers>
},
pomIncludeRepository := {
Expand Down Expand Up @@ -97,7 +102,7 @@ lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plug
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMajor)) if scalaMajor > 10 =>
Seq("org.scala-lang.modules" %% "scala-xml" % "1.1.1")
Seq("org.scala-lang.modules" %% "scala-xml" % "1.2.0")
case _ =>
Seq()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"for objects" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.test\nobject Bammy { def foo = 'boo } ")
compiler.compile("package com.test\nobject Bammy { def foo = Symbol(\"boo\") } ")
val loc = compiler.locations.result().find(_._1 == "Template").get._2
loc.packageName shouldBe "com.test"
loc.className shouldBe "Bammy"
Expand All @@ -30,7 +30,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"for traits" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.test\ntrait Gammy { def goo = 'hoo } ")
compiler.compile("package com.test\ntrait Gammy { def goo = Symbol(\"hoo\") } ")
val loc = compiler.locations.result().find(_._1 == "Template").get._2
loc.packageName shouldBe "com.test"
loc.className shouldBe "Gammy"
Expand All @@ -42,7 +42,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"should correctly process methods" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.methodtest \n class Hammy { def foo = 'boo } ")
compiler.compile("package com.methodtest \n class Hammy { def foo = Symbol(\"boo\") } ")
val loc = compiler.locations.result().find(_._2.method == "foo").get._2
loc.packageName shouldBe "com.methodtest"
loc.className shouldBe "Hammy"
Expand Down Expand Up @@ -150,7 +150,7 @@ class LocationTest extends FreeSpec with Matchers {
"should use <none> method name" - {
"for class constructor body" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.b \n class Tammy { val name = 'sam } ")
compiler.compile("package com.b \n class Tammy { val name = Symbol(\"sam\") } ")
val loc = compiler.locations.result().find(_._1 == "ValDef").get._2
loc.packageName shouldBe "com.b"
loc.className shouldBe "Tammy"
Expand All @@ -161,7 +161,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"for object constructor body" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.b \n object Yammy { val name = 'sam } ")
compiler.compile("package com.b \n object Yammy { val name = Symbol(\"sam\") } ")
val loc = compiler.locations.result().find(_._1 == "ValDef").get._2
loc.packageName shouldBe "com.b"
loc.className shouldBe "Yammy"
Expand All @@ -172,7 +172,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"for trait constructor body" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.b \n trait Wammy { val name = 'sam } ")
compiler.compile("package com.b \n trait Wammy { val name = Symbol(\"sam\") } ")
val loc = compiler.locations.result().find(_._1 == "ValDef").get._2
loc.packageName shouldBe "com.b"
loc.className shouldBe "Wammy"
Expand Down Expand Up @@ -209,7 +209,7 @@ class LocationTest extends FreeSpec with Matchers {
}
"doubly nested classes should report correct fullClassName" in {
val compiler = ScoverageCompiler.locationCompiler
compiler.compile("package com.a \n object Foo { object Boo { object Moo { val name = 'sam } } }")
compiler.compile("package com.a \n object Foo { object Boo { object Moo { val name = Symbol(\"sam\") } } }")
val loc = compiler.locations.result().find(_._1 == "ValDef").get._2
loc.packageName shouldBe "com.a"
loc.className shouldBe "Moo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PluginCoverageTest
compiler.compileCodeSnippet( """ object DefaultArgumentsObject {
| val defaultName = "world"
| def makeGreeting(name: String = defaultName): String = {
| s"Hello, $name"
| "Hello, " + name
| }
|} """.stripMargin)
assert(!compiler.reporter.hasErrors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object ScoverageCompiler {

def settings: Settings = {
val s = new scala.tools.nsc.Settings
s.Xprint.value = List("all")
s.Xprint.value = List("all", "_")
s.deprecation.value = true
s.Yrangepos.value = true
s.Yposdebug.value = true
Expand Down Expand Up @@ -99,9 +99,10 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
compileSourceFiles(urls.map(_.getFile).map(new File(_)): _*)
}

def assertNoErrors() = assert(!reporter.hasErrors)
def assertNoErrors() = assert(!reporter.hasErrors, "There are compilation errors")

def assertNoCoverage() = assert(!testStore.sources.mkString(" ").contains(s"scoverage.Invoker.invoked"))
def assertNoCoverage() = assert(!testStore.sources.mkString(" ").contains(s"scoverage.Invoker.invoked"),
"There are scoverage.Invoker.invoked instructions added to the code")

def assertNMeasuredStatements(n: Int): Unit = {
for (k <- 1 to n) {
Expand Down