From 0c66d1a5d3130b0362b5369a746c87ebcbfe343b Mon Sep 17 00:00:00 2001 From: cheeseng Date: Thu, 27 Jun 2013 17:29:36 +0800 Subject: [PATCH] Added support of Ignore, Canceled and Pending added in the latest framework API. --- main/actions/src/main/scala/sbt/Tests.scala | 10 ++++++---- testing/src/main/scala/sbt/TestReportListener.scala | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/main/actions/src/main/scala/sbt/Tests.scala b/main/actions/src/main/scala/sbt/Tests.scala index f3ade18a5..b612720a8 100644 --- a/main/actions/src/main/scala/sbt/Tests.scala +++ b/main/actions/src/main/scala/sbt/Tests.scala @@ -230,12 +230,14 @@ object Tests // Print the standard one-liner statistic if no framework summary is defined, or when > 1 framework is in used. if (printStandard) { - val (skippedCount, errorsCount, passedCount, failuresCount) = - results.events.foldLeft((0, 0, 0, 0)) { case (acc, (name, testEvent)) => - (acc._1 + testEvent.skippedCount, acc._2 + testEvent.errorCount, acc._3 + testEvent.passedCount, acc._4 + testEvent.failureCount) + val (skippedCount, errorsCount, passedCount, failuresCount, ignoredCount, canceledCount, pendingCount) = + results.events.foldLeft((0, 0, 0, 0, 0, 0, 0)) { case ((skippedAcc, errorAcc, passedAcc, failureAcc, ignoredAcc, canceledAcc, pendingAcc), (name, testEvent)) => + (skippedAcc + testEvent.skippedCount, errorAcc + testEvent.errorCount, passedAcc + testEvent.passedCount, failureAcc + testEvent.failureCount, + ignoredAcc + testEvent.ignoredCount, canceledAcc + testEvent.canceledCount, pendingAcc + testEvent.pendingCount) } val totalCount = failuresCount + errorsCount + skippedCount + passedCount - val postfix = "Total " + totalCount + ", Failed " + failuresCount + ", Errors " + errorsCount + ", Passed " + passedCount + ", Skipped " + skippedCount + val postfix = "Total " + totalCount + ", Failed " + failuresCount + ", Errors " + errorsCount + ", Passed " + passedCount + ", Skipped " + skippedCount + + ", Ignored " + ignoredCount + ", Canceled " + canceledCount + ", Pending " + pendingCount results.overall match { case TestResult.Error => log.error("Error: " + postfix) case TestResult.Passed => log.info("Passed: " + postfix) diff --git a/testing/src/main/scala/sbt/TestReportListener.scala b/testing/src/main/scala/sbt/TestReportListener.scala index 9cb4e66c5..7895b9f8e 100644 --- a/testing/src/main/scala/sbt/TestReportListener.scala +++ b/testing/src/main/scala/sbt/TestReportListener.scala @@ -28,7 +28,8 @@ trait TestsListener extends TestReportListener def doComplete(finalResult: TestResult.Value) } -final class SuiteResult(val result: TestResult.Value, val passedCount: Int, val failureCount: Int, val errorCount: Int, val skippedCount: Int) +final class SuiteResult(val result: TestResult.Value, val passedCount: Int, val failureCount: Int, val errorCount: Int, val skippedCount: Int, + val ignoredCount: Int, val canceledCount: Int, val pendingCount: Int) object SuiteResult { def apply(events: Seq[TEvent]): SuiteResult = @@ -40,10 +41,11 @@ object SuiteResult else if(sum == TestResult.Failed || status == TStatus.Failure) TestResult.Failed else TestResult.Passed } - new SuiteResult (overallResult, count(TStatus.Success), count(TStatus.Failure), count(TStatus.Error), count(TStatus.Skipped)) + new SuiteResult (overallResult, count(TStatus.Success), count(TStatus.Failure), count(TStatus.Error), count(TStatus.Skipped), + count(TStatus.Ignored), count(TStatus.Canceled), count(TStatus.Pending)) } - val Error: SuiteResult = new SuiteResult(TestResult.Error, 0, 0, 0, 0) - val Empty: SuiteResult = new SuiteResult(TestResult.Passed, 0, 0, 0, 0) + val Error: SuiteResult = new SuiteResult(TestResult.Error, 0, 0, 0, 0, 0, 0, 0) + val Empty: SuiteResult = new SuiteResult(TestResult.Passed, 0, 0, 0, 0, 0, 0, 0) } abstract class TestEvent extends NotNull