mirror of https://github.com/sbt/sbt.git
Merge pull request #2178 from Duhemm/scripted-pending
Run pending tests in scripted, consider their successes as failures
This commit is contained in:
commit
6f8eaab026
|
|
@ -19,10 +19,11 @@ object Scripted {
|
|||
case class ScriptedTestPage(page: Int, total: Int)
|
||||
def scriptedParser(scriptedBase: File): Parser[Seq[String]] =
|
||||
{
|
||||
val pairs = (scriptedBase * AllPassFilter * AllPassFilter * "test").get map { (f: File) =>
|
||||
val scriptedFiles: NameFilter = ("test": NameFilter) | "pending"
|
||||
val pairs = (scriptedBase * AllPassFilter * AllPassFilter * scriptedFiles).get map { (f: File) =>
|
||||
val p = f.getParentFile
|
||||
(p.getParentFile.getName, p.getName)
|
||||
};
|
||||
}
|
||||
val pairMap = pairs.groupBy(_._1).mapValues(_.map(_._2).toSet);
|
||||
|
||||
val id = charClass(c => !c.isWhitespace && c != '/').+.string
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc
|
|||
None
|
||||
} else {
|
||||
try { scriptedTest(str, testDirectory, prescripted, log); None }
|
||||
catch { case e: xsbt.test.TestException => Some(str) }
|
||||
catch { case _: xsbt.test.TestException | _: PendingTestSuccessException => Some(str) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,6 +81,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc
|
|||
prescripted(testDirectory)
|
||||
runTest()
|
||||
buffered.info("+ " + label + pendingString)
|
||||
if (pending) throw new PendingTestSuccessException(label)
|
||||
} catch {
|
||||
case e: xsbt.test.TestException =>
|
||||
testFailed()
|
||||
|
|
@ -89,6 +90,10 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc
|
|||
case _ => e.printStackTrace
|
||||
}
|
||||
if (!pending) throw e
|
||||
case e: PendingTestSuccessException =>
|
||||
testFailed()
|
||||
buffered.error(" Mark as passing to remove this failure.")
|
||||
throw e
|
||||
case e: Exception =>
|
||||
testFailed()
|
||||
if (!pending) throw e
|
||||
|
|
@ -209,3 +214,7 @@ object CompatibilityLevel extends Enumeration {
|
|||
case Minimal28 => "2.8.1"
|
||||
}
|
||||
}
|
||||
class PendingTestSuccessException(label: String) extends Exception {
|
||||
override def getMessage: String =
|
||||
s"The pending test $label succeeded. Mark this test as passing to remove this failure."
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue