From d36e1022cee68d0a443f4afc5004ac5fa62d81a8 Mon Sep 17 00:00:00 2001 From: Chua Chee Seng Date: Tue, 6 Dec 2022 09:59:13 +0800 Subject: [PATCH 1/3] Adjusted code in StepwiseNestedSuiteExecution to work with async test. --- .../scalatest/StepwiseNestedSuiteExecution.scala | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala index b8ca4040e3..32611d39c1 100644 --- a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala +++ b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala @@ -69,9 +69,18 @@ trait StepwiseNestedSuiteExecution extends SuiteMixin { thisSuite: Suite => val rawString = Resources.suiteCompletedNormally val formatter = formatterForSuiteCompleted(nestedSuite) - val duration = System.currentTimeMillis - suiteStartTime - report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner)) - SucceededStatus + distributor match { + case Some(_) => + status.withAfterEffect { + val duration = System.currentTimeMillis - suiteStartTime + report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner)) + } + + case None => + val duration = System.currentTimeMillis - suiteStartTime + report(SuiteCompleted(tracker.nextOrdinal(), nestedSuite.suiteName, nestedSuite.suiteId, Some(suiteClassName), Some(duration), formatter, Some(TopOfClass(nestedSuite.getClass.getName)), nestedSuite.rerunner)) + } + status } catch { case e: RuntimeException => { From 89610ea0b438c25733780d9060e040a60a92fe58 Mon Sep 17 00:00:00 2001 From: Chua Chee Seng Date: Tue, 6 Dec 2022 10:48:40 +0800 Subject: [PATCH 2/3] Updated scaladoc in StepwiseNestedSuiteExecution.scala about passing down None for distributor field, it no longer true. --- .../main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala index 32611d39c1..cb9e828cd9 100644 --- a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala +++ b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala @@ -28,7 +28,7 @@ import collection.mutable.ListBuffer * Trait that causes the nested suites of any suite it is mixed into to be run sequentially even if * a Distributor is passed to runNestedSuites. This trait overrides the * runNestedSuites method and fowards every parameter passed to it to a superclass invocation - * of runNestedSuites, except it always passes None for the Distributor. + * of runNestedSuites, and make the nested suites are run and completed one after one in order. * Mix in this trait into any suite whose nested suites need to be run sequentially even with the rest of the * run is being executed concurrently. */ From 9b42d4040dc86b222f901d24ac58ea84d74bb5e6 Mon Sep 17 00:00:00 2001 From: Chua Chee Seng Date: Tue, 6 Dec 2022 22:31:17 +0800 Subject: [PATCH 3/3] Added the missing 'sure' word in new scaladoc text in StepwiseNestedSuiteExecution.scala. --- .../main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala index cb9e828cd9..eddc4bb948 100644 --- a/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala +++ b/jvm/core/src/main/scala/org/scalatest/StepwiseNestedSuiteExecution.scala @@ -28,7 +28,7 @@ import collection.mutable.ListBuffer * Trait that causes the nested suites of any suite it is mixed into to be run sequentially even if * a Distributor is passed to runNestedSuites. This trait overrides the * runNestedSuites method and fowards every parameter passed to it to a superclass invocation - * of runNestedSuites, and make the nested suites are run and completed one after one in order. + * of runNestedSuites, and make sure the nested suites are run and completed one after one in order. * Mix in this trait into any suite whose nested suites need to be run sequentially even with the rest of the * run is being executed concurrently. */