Add alternative scripted filenames

This commit is contained in:
Filipe Regadas 2018-06-19 14:59:04 -04:00
parent e313193609
commit 0fb07a861b
4 changed files with 14 additions and 6 deletions

View File

@ -120,7 +120,8 @@ object ScriptedPlugin extends AutoPlugin {
private[sbt] def scriptedParser(scriptedBase: File): Parser[Seq[String]] = {
import DefaultParsers._
val scriptedFiles: NameFilter = ("test": NameFilter) | "pending"
val scriptedFiles
: NameFilter = ("test": NameFilter) | "test.script" | "pending" | "pending.script"
val pairs = (scriptedBase * AllPassFilter * AllPassFilter * scriptedFiles).get map {
(f: File) =>
val p = f.getParentFile

View File

@ -0,0 +1 @@
lazy val root = (project in file("."))

View File

@ -0,0 +1 @@
> test

View File

@ -8,7 +8,7 @@
package sbt
package scriptedtest
import java.io.File
import java.io.{ File, FileNotFoundException }
import java.net.SocketException
import java.util.Properties
import java.util.concurrent.ForkJoinPool
@ -17,7 +17,6 @@ import scala.collection.GenSeq
import scala.collection.mutable
import scala.collection.parallel.ForkJoinTaskSupport
import scala.util.control.NonFatal
import sbt.internal.scripted._
import sbt.internal.io.Resources
import sbt.internal.util.{ BufferedLogger, ConsoleLogger, FullLogger }
@ -386,9 +385,15 @@ final class ScriptedTests(
if (bufferLog) log.record()
val (file, pending) = {
val normal = new File(testDirectory, ScriptFilename)
val pending = new File(testDirectory, PendingScriptFilename)
if (pending.isFile) (pending, true) else (normal, false)
val normal = (new File(testDirectory, ScriptFilename), false)
val normalScript = (new File(testDirectory, s"$ScriptFilename.script"), false)
val pending = (new File(testDirectory, PendingScriptFilename), true)
val pendingScript = (new File(testDirectory, s"$PendingScriptFilename.script"), true)
List(pending, pendingScript, normal, normalScript).find(_._1.isFile) match {
case Some(script) => script
case None => throw new FileNotFoundException("no test scripts found")
}
}
val pendingMark = if (pending) PendingLabel else ""