Skip to content

Commit f0cb420

Browse files
authored
Merge pull request sbt#7031 from gontard/backport_6903_to_1.8.x
Backport sbt#6903 to 1.8.x
2 parents e71e082 + cc44169 commit f0cb420

File tree

9 files changed

+31
-16
lines changed

9 files changed

+31
-16
lines changed

DEVELOPING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ suite with `sbt testOnly`
151151

152152
#### Integration tests
153153

154-
Scripted integration tests reside in `sbt/src/sbt-test` and are
154+
Scripted integration tests reside in `sbt-app/src/sbt-test` and are
155155
written using the same testing infrastructure sbt plugin authors can
156156
use to test their own plugins with sbt. You can read more about this
157157
style of tests [here](https://www.scala-sbt.org/1.0/docs/Testing-sbt-plugins).
158158

159159
You can run the integration tests with the `sbt scripted` sbt
160160
command. To run a single test, such as the test in
161-
`sbt/src/sbt-test/project/global-plugin`, simply run:
161+
`sbt-app/src/sbt-test/project/global-plugin`, simply run:
162162

163163
sbt "scripted project/global-plugin"
164164

main/src/main/scala/sbt/Defaults.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,11 +1393,10 @@ object Defaults extends BuildCommon {
13931393
val x = {
13941394
import analysis.{ apis, relations => rel }
13951395
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
1396-
rel.externalDeps(c).map(stamp) +
1397-
(apis.internal.get(c) match {
1398-
case Some(x) => x.compilationTimestamp
1399-
case _ => Long.MinValue
1400-
})
1396+
rel.externalDeps(c).map(stamp) ++
1397+
rel.productClassName.reverse(c).flatMap { pc =>
1398+
apis.internal.get(pc).map(_.compilationTimestamp)
1399+
} + Long.MinValue
14011400
}.max
14021401
if (x != Long.MinValue) {
14031402
stamps(c) = x
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
2-
val scalaxml = "org.scala-lang.modules" %% "scala-xml" % "1.1.1"
32
ThisBuild / scalaVersion := "2.12.12"
43

54
lazy val root = (project in file("."))
65
.settings(
7-
libraryDependencies ++= List(scalaxml, scalatest),
6+
libraryDependencies += scalatest % Test,
87
Test / parallelExecution := false
98
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object MathFunction {
2+
def times2(i: Int): Int = 2 * 2
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object MathFunction {
2+
def times2(i: Int): Int = i * 2
3+
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import org.scalatest.FlatSpec
2-
import org.scalatest.matchers.ShouldMatchers
32

4-
class Create extends FlatSpec with ShouldMatchers with Base {
3+
class Create extends FlatSpec with Base {
54
"a file" should "not exist" in {
65
A(new B).foo
7-
marker.exists should equal(false)
8-
marker.createNewFile() should equal (true)
6+
assert(marker.exists == false)
7+
assert(marker.createNewFile() == true)
98
}
109

1110
}

sbt-app/src/sbt-test/tests/test-quick/src/test/scala/Delete.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import org.scalatest.FlatSpec
2-
import org.scalatest.matchers.ShouldMatchers
32

4-
class Delete extends FlatSpec with ShouldMatchers with Base {
3+
class Delete extends FlatSpec with Base {
54
"a file" should "exist" in {
6-
marker.exists should equal(true)
5+
assert(marker.exists == true)
76
marker.delete()
87
}
98

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import org.scalatest.FlatSpec
2+
3+
class MathFunctionTest extends FlatSpec {
4+
"times2" should "double the input" in {
5+
assert(MathFunction.times2(4) == 8)
6+
}
7+
}

sbt-app/src/sbt-test/tests/test-quick/disabled renamed to sbt-app/src/sbt-test/tests/test-quick/test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ $ sleep 2000
3232
-> testQuick Create
3333
> testQuick Delete
3434
> testQuick Create
35+
36+
# https://github.com/sbt/sbt/issues/5504
37+
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
38+
> compile
39+
$ sleep 2000
40+
-> testQuick MathFunctionTest

0 commit comments

Comments
 (0)