Skip to content

Commit

Permalink
Make instrumentation happen before patmat mangles match-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkopone committed Dec 7, 2012
1 parent 35a6c22 commit 43249e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/scalac-plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<plugin>
<name>scctPlugin</name>
<name>scctInstrumentation</name>
<classname>reaktor.scct.ScctInstrumentPlugin</classname>
</plugin>
4 changes: 2 additions & 2 deletions src/main/scala/reaktor/scct/ScctInstrumentPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import util.Random
class ScctInstrumentPlugin(val global: Global) extends Plugin {
val name = "scct"
val description = "Scala code coverage instrumentation plugin."
val runsAfter = List("typer")

val options = new ScctInstrumentPluginOptions()
val components = List(new ScctTransformComponent(global, options))

Expand Down Expand Up @@ -50,6 +48,8 @@ class ScctTransformComponent(val global: Global, val opts:ScctInstrumentPluginOp
import global.definitions._

val runsAfter = List[String]("typer")
override val runsBefore = List[String]("patmat")

val phaseName = "scctInstrumentation"
def newTransformer(unit: CompilationUnit) = new Instrumenter(unit)

Expand Down
8 changes: 5 additions & 3 deletions src/test/scala/reaktor/scct/ScctInstrumentPluginSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ class ScctInstrumentPluginSpec extends Specification with Mockito {
sut.name mustEqual "scct"
sut.description mustEqual "Scala code coverage instrumentation plugin."
}
"run after typer" in {
sut.runsAfter mustEqual List("typer")
}
"only contain the transformer component" in {
val components = sut.components
components.size mustEqual 1
components(0) must haveClass[ScctTransformComponent]
}
"run after typer and before patmat" in {
val c = sut.components(0)
c.runsAfter mustEqual List("typer")
c.runsBefore mustEqual List("patmat")
}
}

"Plugin options" should {
Expand Down

0 comments on commit 43249e6

Please sign in to comment.