preserve compatibility for TestCleanup and TestSetup

This commit is contained in:
Mark Harrah 2010-10-09 15:19:06 -04:00
parent ccb5141ae0
commit c87fae4465
2 changed files with 7 additions and 5 deletions

View File

@ -69,11 +69,13 @@ trait ScalaProject extends SimpleScalaProject with FileTasks with MultiTaskProje
trait PackageOption extends ActionOption
trait TestOption extends ActionOption
case class TestSetup(setup: ClassLoader => Unit) extends TestOption {
def this(setup: () => Unit) = this(_ => setup())
final case class TestSetup(setup: ClassLoader => Unit) extends TestOption
object TestSetup {
def apply(setup: () => Unit) = new TestSetup(_ => setup())
}
case class TestCleanup(cleanup: ClassLoader => Unit) extends TestOption {
def this(setup: () => Unit) = this(_ => setup())
final case class TestCleanup(cleanup: ClassLoader => Unit) extends TestOption
object TestCleanup {
def apply(setup: () => Unit) = new TestCleanup(_ => setup())
}
case class ExcludeTests(tests: Iterable[String]) extends TestOption
case class TestListeners(listeners: Iterable[TestReportListener]) extends TestOption

View File

@ -139,7 +139,7 @@ object TestFramework
val mappedTests = testMap(arguments.keys.toList, tests, arguments)
if(mappedTests.isEmpty)
(new NamedTestTask(TestStartName, None) :: Nil, Nil, new NamedTestTask(TestFinishName, { log.info("No tests to run."); cleanTmp() }) :: Nil )
(new NamedTestTask(TestStartName, None) :: Nil, Nil, new NamedTestTask(TestFinishName, { log.info("No tests to run."); cleanTmp(loader) }) :: Nil )
else
createTestTasks(loader, mappedTests, log, listeners, endErrorsEnabled, setup, Seq(cleanTmp) ++ cleanup)
}