Created
August 12, 2015 14:58
-
-
Save Duhemm/abf4749000189f5d1fef to your computer and use it in GitHub Desktop.
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
package sbt.incrementalcompiler | |
import org.specs2.Specification | |
class IncrementalTest extends Specification { | |
import IncrementalCompilerTest._ | |
def is = s2""" | |
This is a specification for the incremental compiler. | |
The incremental compiler should | |
execute the first scenario $firstScenario | |
execute the second scenario $secondScenario | |
execute the third scenario $thirdScenario | |
execute the fourth scenario $fourthScenario | |
""" | |
def compiler = new xsbt.TestAnalyzingCompiler(sbt.inc.IncOptions.Default) | |
def firstScenario = | |
compiler execute Scenario ( | |
FailedCompile( | |
"A.scala" -> "hello") | |
) | |
def secondScenario = | |
compiler execute Scenario ( | |
FullCompilation( | |
expectedSteps = 1, | |
"A.scala" -> "object A extends B", | |
"B.scala" -> "class B"), | |
FailedCompile( | |
"B.scala" -> "final class B"), | |
FailedCompile( | |
"B.scala" -> delete), | |
IncrementalStep( | |
"A.scala" -> "object A") | |
) | |
def thirdScenario = | |
compiler execute Scenario ( | |
FullCompilation( | |
expectedSteps = 1, | |
"A.scala" -> "class A extends B", | |
"B.scala" -> "class B"), | |
IncrementalStep( | |
"B.scala" -> "class B { def foo = 1 }") invalidates ("A.scala"), | |
FullCompilation( | |
expectedSteps = 1, | |
"A.scala" -> "class A extends B { override def foo = 2 }"), | |
FailedCompile( | |
"B.scala" -> delete), | |
FullCompilation( | |
expectedSteps = 1, | |
"A.scala" -> "class A { def foo = 2 }") | |
) | |
def fourthScenario = | |
compiler execute Scenario ( | |
FullCompilation( | |
expectedSteps = 1, | |
"C.scala" -> "class C extends A", | |
"A.scala" -> "class A extends B", | |
"B.scala" -> "class B"), | |
IncrementalStep( | |
"B.scala" -> "class B { def foo = 1 }") invalidates ("A.scala", "C.scala"), | |
FullCompilation( | |
expectedSteps = 2, | |
"A.scala" -> "class A extends B { override def foo = 2 }"), | |
FailedCompile( | |
"B.scala" -> delete) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment