mirror of https://github.com/sbt/sbt.git
Merge pull request #7031 from gontard/backport_6903_to_1.8.x
Backport #6903 to 1.8.x
This commit is contained in:
commit
f0cb420fe2
|
|
@ -151,14 +151,14 @@ suite with `sbt testOnly`
|
||||||
|
|
||||||
#### Integration tests
|
#### 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
|
written using the same testing infrastructure sbt plugin authors can
|
||||||
use to test their own plugins with sbt. You can read more about this
|
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).
|
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
|
You can run the integration tests with the `sbt scripted` sbt
|
||||||
command. To run a single test, such as the test in
|
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"
|
sbt "scripted project/global-plugin"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1393,11 +1393,10 @@ object Defaults extends BuildCommon {
|
||||||
val x = {
|
val x = {
|
||||||
import analysis.{ apis, relations => rel }
|
import analysis.{ apis, relations => rel }
|
||||||
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||||
rel.externalDeps(c).map(stamp) +
|
rel.externalDeps(c).map(stamp) ++
|
||||||
(apis.internal.get(c) match {
|
rel.productClassName.reverse(c).flatMap { pc =>
|
||||||
case Some(x) => x.compilationTimestamp
|
apis.internal.get(pc).map(_.compilationTimestamp)
|
||||||
case _ => Long.MinValue
|
} + Long.MinValue
|
||||||
})
|
|
||||||
}.max
|
}.max
|
||||||
if (x != Long.MinValue) {
|
if (x != Long.MinValue) {
|
||||||
stamps(c) = x
|
stamps(c) = x
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
|
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
|
||||||
val scalaxml = "org.scala-lang.modules" %% "scala-xml" % "1.1.1"
|
|
||||||
ThisBuild / scalaVersion := "2.12.12"
|
ThisBuild / scalaVersion := "2.12.12"
|
||||||
|
|
||||||
lazy val root = (project in file("."))
|
lazy val root = (project in file("."))
|
||||||
.settings(
|
.settings(
|
||||||
libraryDependencies ++= List(scalaxml, scalatest),
|
libraryDependencies += scalatest % Test,
|
||||||
Test / parallelExecution := false
|
Test / parallelExecution := false
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
object MathFunction {
|
||||||
|
def times2(i: Int): Int = 2 * 2
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
object MathFunction {
|
||||||
|
def times2(i: Int): Int = i * 2
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import org.scalatest.FlatSpec
|
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 file" should "not exist" in {
|
||||||
A(new B).foo
|
A(new B).foo
|
||||||
marker.exists should equal(false)
|
assert(marker.exists == false)
|
||||||
marker.createNewFile() should equal (true)
|
assert(marker.createNewFile() == true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import org.scalatest.FlatSpec
|
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 {
|
"a file" should "exist" in {
|
||||||
marker.exists should equal(true)
|
assert(marker.exists == true)
|
||||||
marker.delete()
|
marker.delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import org.scalatest.FlatSpec
|
||||||
|
|
||||||
|
class MathFunctionTest extends FlatSpec {
|
||||||
|
"times2" should "double the input" in {
|
||||||
|
assert(MathFunction.times2(4) == 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,3 +32,9 @@ $ sleep 2000
|
||||||
-> testQuick Create
|
-> testQuick Create
|
||||||
> testQuick Delete
|
> testQuick Delete
|
||||||
> testQuick Create
|
> testQuick Create
|
||||||
|
|
||||||
|
# https://github.com/sbt/sbt/issues/5504
|
||||||
|
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
|
||||||
|
> compile
|
||||||
|
$ sleep 2000
|
||||||
|
-> testQuick MathFunctionTest
|
||||||
Loading…
Reference in New Issue