mirror of https://github.com/sbt/sbt.git
[2.x] test: Add a regression test for incremental test (#9608)
**Problem/Solution** This tests incremental test's stability post-version bump.
This commit is contained in:
parent
42f8b949f7
commit
c0ffc9dc60
|
|
@ -0,0 +1,9 @@
|
||||||
|
package example
|
||||||
|
|
||||||
|
import java.nio.file.{ Files, Paths }
|
||||||
|
|
||||||
|
class FooTest extends munit.FunSuite:
|
||||||
|
test("greeting"):
|
||||||
|
Files.write(Paths.get("test-ran.marker"), "ran".getBytes)
|
||||||
|
assertEquals(Foo.greeting, "hello")
|
||||||
|
end FooTest
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
Global / localCacheDirectory := baseDirectory.value / "diskcache"
|
||||||
|
|
||||||
|
scalaVersion := "3.8.4"
|
||||||
|
|
||||||
|
val munit = "org.scalameta" %% "munit" % "1.0.4"
|
||||||
|
|
||||||
|
lazy val foo = project
|
||||||
|
|
||||||
|
lazy val app = project
|
||||||
|
.dependsOn(foo)
|
||||||
|
.settings(
|
||||||
|
libraryDependencies += munit % Test
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val root = (project in file("."))
|
||||||
|
.aggregate(foo, app)
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package example
|
||||||
|
|
||||||
|
object Foo:
|
||||||
|
def greeting: String = "hello"
|
||||||
|
end Foo
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
# the test suite writes this file as a side effect whenever it actually runs
|
||||||
|
$ absent test-ran.marker
|
||||||
|
|
||||||
|
# warm the disk cache
|
||||||
|
> app/test
|
||||||
|
$ exists test-ran.marker
|
||||||
|
$ delete test-ran.marker
|
||||||
|
|
||||||
|
# after a clean, retesting app should fully restore from the disk cache;
|
||||||
|
# since nothing changed, the test body must not execute again
|
||||||
|
> clean
|
||||||
|
> app/test
|
||||||
|
$ absent test-ran.marker
|
||||||
|
|
||||||
|
# bumping foo's version alone (e.g. what sbt-dynver would do on a new commit) must not
|
||||||
|
# invalidate app's test cache entry, since foo's jar content hasn't changed
|
||||||
|
> set foo / version := "0.2.0"
|
||||||
|
> clean
|
||||||
|
> app/test
|
||||||
|
$ absent test-ran.marker
|
||||||
Loading…
Reference in New Issue