diff --git a/sbt-app/src/sbt-test/tests/version-bump-test/app/src/test/scala/FooTest.scala b/sbt-app/src/sbt-test/tests/version-bump-test/app/src/test/scala/FooTest.scala new file mode 100644 index 000000000..f4176ec28 --- /dev/null +++ b/sbt-app/src/sbt-test/tests/version-bump-test/app/src/test/scala/FooTest.scala @@ -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 diff --git a/sbt-app/src/sbt-test/tests/version-bump-test/build.sbt b/sbt-app/src/sbt-test/tests/version-bump-test/build.sbt new file mode 100644 index 000000000..018640a21 --- /dev/null +++ b/sbt-app/src/sbt-test/tests/version-bump-test/build.sbt @@ -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) diff --git a/sbt-app/src/sbt-test/tests/version-bump-test/foo/Foo.scala b/sbt-app/src/sbt-test/tests/version-bump-test/foo/Foo.scala new file mode 100644 index 000000000..b0be7dc85 --- /dev/null +++ b/sbt-app/src/sbt-test/tests/version-bump-test/foo/Foo.scala @@ -0,0 +1,5 @@ +package example + +object Foo: + def greeting: String = "hello" +end Foo diff --git a/sbt-app/src/sbt-test/tests/version-bump-test/test b/sbt-app/src/sbt-test/tests/version-bump-test/test new file mode 100644 index 000000000..2022a4e49 --- /dev/null +++ b/sbt-app/src/sbt-test/tests/version-bump-test/test @@ -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