diff --git a/sbt/src/sbt-test/tests/test-quick/changed/A.scala b/sbt/src/sbt-test/tests/test-quick/changed/A.scala new file mode 100755 index 000000000..869db8f1c --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/changed/A.scala @@ -0,0 +1,4 @@ +case class A(b: B) { + def foo = b.foo + // A comment added should trigger recompilation. +} \ No newline at end of file diff --git a/sbt/src/sbt-test/tests/test-quick/changed/B.scala b/sbt/src/sbt-test/tests/test-quick/changed/B.scala new file mode 100755 index 000000000..0fcd03a98 --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/changed/B.scala @@ -0,0 +1,5 @@ +class B { + def foo = 1 + // API-level change + def bar(a: A) = 2 +} diff --git a/sbt/src/sbt-test/tests/test-quick/changed/Base.scala b/sbt/src/sbt-test/tests/test-quick/changed/Base.scala new file mode 100755 index 000000000..c569ca19e --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/changed/Base.scala @@ -0,0 +1,7 @@ +import java.io.File + +trait Base { + val marker = new File("marker") + // Test compilation group change. + val baz = "" +} diff --git a/sbt/src/sbt-test/tests/test-quick/project/Build.scala b/sbt/src/sbt-test/tests/test-quick/project/Build.scala new file mode 100755 index 000000000..d8004918c --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/project/Build.scala @@ -0,0 +1,10 @@ +import sbt._ +import Keys._ +import Defaults._ + +object B extends Build { + lazy val root = Project("root", file("."), settings = defaultSettings ++ Seq( + libraryDependencies += "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test", + parallelExecution in test := false + )) +} diff --git a/sbt/src/sbt-test/tests/test-quick/src/main/scala/A.scala b/sbt/src/sbt-test/tests/test-quick/src/main/scala/A.scala new file mode 100755 index 000000000..6e5bc52de --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/src/main/scala/A.scala @@ -0,0 +1,4 @@ +// A, B are referring to each other, OK in the same compilation group. +case class A(b: B) { + def foo = b.foo +} \ No newline at end of file diff --git a/sbt/src/sbt-test/tests/test-quick/src/main/scala/B.scala b/sbt/src/sbt-test/tests/test-quick/src/main/scala/B.scala new file mode 100755 index 000000000..43be25453 --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/src/main/scala/B.scala @@ -0,0 +1,4 @@ +class B { + def foo = 1 + def bar(a: A) {} +} diff --git a/sbt/src/sbt-test/tests/test-quick/src/test/scala/Base.scala b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Base.scala new file mode 100755 index 000000000..5604f26bd --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Base.scala @@ -0,0 +1,5 @@ +import java.io.File + +trait Base { + val marker = new File("marker") +} diff --git a/sbt/src/sbt-test/tests/test-quick/src/test/scala/Create.scala b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Create.scala new file mode 100755 index 000000000..24dc57ea2 --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Create.scala @@ -0,0 +1,11 @@ +import org.scalatest.FlatSpec +import org.scalatest.matchers.ShouldMatchers + +class Create extends FlatSpec with ShouldMatchers with Base { + "a file" should "not exist" in { + A(new B).foo + marker.exists should equal(false) + marker.createNewFile() should equal (true) + } + +} diff --git a/sbt/src/sbt-test/tests/test-quick/src/test/scala/Delete.scala b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Delete.scala new file mode 100755 index 000000000..6bd113901 --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/src/test/scala/Delete.scala @@ -0,0 +1,10 @@ +import org.scalatest.FlatSpec +import org.scalatest.matchers.ShouldMatchers + +class Delete extends FlatSpec with ShouldMatchers with Base { + "a file" should "exist" in { + marker.exists should equal(true) + marker.delete() + } + +} diff --git a/sbt/src/sbt-test/tests/test-quick/test b/sbt/src/sbt-test/tests/test-quick/test new file mode 100755 index 000000000..dec97baa0 --- /dev/null +++ b/sbt/src/sbt-test/tests/test-quick/test @@ -0,0 +1,34 @@ +> test-quick Create +# Create not re-run, Delete deletes the file. +> test-quick +# Re-create the file. +> test-only Create + +# Non-API change +$ copy-file changed/A.scala src/main/scala/A.scala +> compile +$ sleep 2000 +# Create is run. Delete is not since it doesn't have src/main dependency. +-> test-quick +> test-only Delete +# Previous run of Create failed, re-run. +> test-quick Create +# No-op. +> test-quick Create +# API change. + +$ copy-file changed/B.scala src/main/scala/B.scala +> compile +$ sleep 2000 +-> test-quick Create +> test-only Delete +# Previous run of Create failed, re-run. +> test-quick Create +# src/test compilation group change. + +$ copy-file changed/Base.scala src/test/scala/Base.scala +> test:compile +$ sleep 2000 +-> test-quick Create +> test-quick Delete +> test-quick Create \ No newline at end of file