Merge pull request #7031 from gontard/backport_6903_to_1.8.x

Backport #6903 to 1.8.x
This commit is contained in:
eugene yokota 2022-09-30 11:43:20 -04:00 committed by GitHub
commit f0cb420fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 16 deletions

View File

@ -151,14 +151,14 @@ suite with `sbt testOnly`
#### Integration tests
Scripted integration tests reside in `sbt/src/sbt-test` and are
Scripted integration tests reside in `sbt-app/src/sbt-test` and are
written using the same testing infrastructure sbt plugin authors can
use to test their own plugins with sbt. You can read more about this
style of tests [here](https://www.scala-sbt.org/1.0/docs/Testing-sbt-plugins).
You can run the integration tests with the `sbt scripted` sbt
command. To run a single test, such as the test in
`sbt/src/sbt-test/project/global-plugin`, simply run:
`sbt-app/src/sbt-test/project/global-plugin`, simply run:
sbt "scripted project/global-plugin"

View File

@ -1393,11 +1393,10 @@ object Defaults extends BuildCommon {
val x = {
import analysis.{ apis, relations => rel }
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
rel.externalDeps(c).map(stamp) +
(apis.internal.get(c) match {
case Some(x) => x.compilationTimestamp
case _ => Long.MinValue
})
rel.externalDeps(c).map(stamp) ++
rel.productClassName.reverse(c).flatMap { pc =>
apis.internal.get(pc).map(_.compilationTimestamp)
} + Long.MinValue
}.max
if (x != Long.MinValue) {
stamps(c) = x

View File

@ -1,9 +1,8 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
val scalaxml = "org.scala-lang.modules" %% "scala-xml" % "1.1.1"
ThisBuild / scalaVersion := "2.12.12"
lazy val root = (project in file("."))
.settings(
libraryDependencies ++= List(scalaxml, scalatest),
libraryDependencies += scalatest % Test,
Test / parallelExecution := false
)

View File

@ -0,0 +1,3 @@
object MathFunction {
def times2(i: Int): Int = 2 * 2
}

View File

@ -0,0 +1,3 @@
object MathFunction {
def times2(i: Int): Int = i * 2
}

View File

@ -1,11 +1,10 @@
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class Create extends FlatSpec with ShouldMatchers with Base {
class Create extends FlatSpec with Base {
"a file" should "not exist" in {
A(new B).foo
marker.exists should equal(false)
marker.createNewFile() should equal (true)
assert(marker.exists == false)
assert(marker.createNewFile() == true)
}
}

View File

@ -1,9 +1,8 @@
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class Delete extends FlatSpec with ShouldMatchers with Base {
class Delete extends FlatSpec with Base {
"a file" should "exist" in {
marker.exists should equal(true)
assert(marker.exists == true)
marker.delete()
}

View File

@ -0,0 +1,7 @@
import org.scalatest.FlatSpec
class MathFunctionTest extends FlatSpec {
"times2" should "double the input" in {
assert(MathFunction.times2(4) == 8)
}
}

View File

@ -32,3 +32,9 @@ $ sleep 2000
-> testQuick Create
> testQuick Delete
> testQuick Create
# https://github.com/sbt/sbt/issues/5504
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
> compile
$ sleep 2000
-> testQuick MathFunctionTest