Skip to content

Commit

Permalink
Merge pull request #363 from scala-native/topic/auto-discovery
Browse files Browse the repository at this point in the history
Automatically discover unit tests
  • Loading branch information
densh committed Oct 28, 2016
2 parents ff3ecf7 + 771b50a commit f3b0e28
Show file tree
Hide file tree
Showing 6 changed files with 462 additions and 468 deletions.
22 changes: 22 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,28 @@ lazy val tests =
.in(file("unit-tests"))
.settings(projectSettings)
.settings(noPublishSettings)
.settings(
sourceGenerators in Compile += Def.task {
val dir = sourceDirectory.value
val prefix = dir.getAbsolutePath + "/main/scala/"
val suites = (dir ** "*Suite.scala").get.map { f =>
f.getAbsolutePath
.replace(prefix, "")
.replace(".scala", "")
.split("/")
.mkString(".")
}.filter(_ != "tests.Suite").mkString("Seq(", ", ", ")")
val file = (sourceManaged in Compile).value / "tests" / "Disover.scala"
IO.write(file,
s"""
package tests
object Discover {
val suites: Seq[tests.Suite] = $suites
}
""")
Seq(file)
}.taskValue
)

lazy val sandbox =
project
Expand Down

0 comments on commit f3b0e28

Please sign in to comment.