Select the first test fingerprint for a test name for forked tests

Move the 'distinct by name' filter to Tests.processOptions, which is used
by both in-process and forked tests.
This commit is contained in:
Peter Vlugter
2014-07-14 11:57:52 +12:00
parent e1c2c435d1
commit f7fbdb0281
3 changed files with 15 additions and 10 deletions
@@ -131,19 +131,13 @@ object TestFramework {
log: Logger,
listeners: Seq[TestReportListener]): (() => Unit, Seq[(String, TestFunction)], TestResult.Value => () => Unit) =
{
val unique = distinctBy(tests)(_.name)
val mappedTests = testMap(frameworks.values.toSeq, unique)
val mappedTests = testMap(frameworks.values.toSeq, tests)
if (mappedTests.isEmpty)
(() => (), Nil, _ => () => ())
else
createTestTasks(testLoader, runners.map { case (tf, r) => (frameworks(tf), new TestRunner(r, listeners, log)) }, mappedTests, unique, log, listeners)
createTestTasks(testLoader, runners.map { case (tf, r) => (frameworks(tf), new TestRunner(r, listeners, log)) }, mappedTests, tests, log, listeners)
}
private[this] def distinctBy[T, K](in: Seq[T])(f: T => K): Seq[T] =
{
val seen = new collection.mutable.HashSet[K]
in.filter(t => seen.add(f(t)))
}
private[this] def order(mapped: Map[String, TestFunction], inputs: Seq[TestDefinition]): Seq[(String, TestFunction)] =
for (d <- inputs; act <- mapped.get(d.name)) yield (d.name, act)