-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Scala.js and Scala Native
SlaveRunner
s losing info about other …
…running suites Support non-singleton semantics in RunningSuite.lazyHandle if running on Scala.js/Native worker where singletons are impossible Add RunningSuitesSpec
- Loading branch information
Showing
13 changed files
with
214 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
jvm/scalatest-test/src/test/scala/org/scalatest/tools/RunningSuitesSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.scalatest.tools | ||
|
||
import org.scalatest.{Args, RunningSuite, Status} | ||
import org.scalatest.funspec.AnyFunSpec | ||
|
||
class RunningSuitesSpec extends AnyFunSpec { | ||
|
||
var runningSuites: List[RunningSuite] = _ | ||
|
||
override def run(testName: Option[String], args: Args): Status = { | ||
this.runningSuites = args.runningSuites | ||
super.run(testName, args) | ||
} | ||
|
||
it("Args.runningSuites contains the current running suite") { | ||
runningSuites.find(_.className == this.getClass.getName) match { | ||
case Some(thisSuite) => | ||
if (thisSuite.isSingleton) { | ||
assert(thisSuite.lazyHandle() == this) | ||
} else { | ||
cancel("Running in a worker process") | ||
} | ||
case None => | ||
fail("Expected Args.runningSuites to contain the current suite") | ||
} | ||
} | ||
|
||
it("Args.runningSuites contains other suites if not running under testOnly") { | ||
if (runningSuites.size == 1) { | ||
cancel(s"Running in testOnly. $runningSuites") | ||
} else { | ||
assert(runningSuites.size > 1) | ||
assert(runningSuites == runningSuites.distinct) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.