Use scripted hook to run reload

This saves us from duplicating error handling logic to correctly manage
`pending` tests whose projects don't even load (and make our reload)
fail.
This commit is contained in:
jvican 2017-05-02 01:22:15 +02:00
parent 210dcde822
commit c94a445737
No known key found for this signature in database
GPG Key ID: 42DAFA0F112E8050
1 changed files with 6 additions and 2 deletions

View File

@ -145,8 +145,12 @@ final class ScriptedTests(resourceBaseDirectory: File,
val sbtHandler = handlers.getOrElse('>', sys.error("Missing sbt handler."))
val statement =
Statement(";reload;initialize", Nil, successExpected = true, line = -1)
runner.processStatement(sbtHandler.asInstanceOf[SbtHandler], statement, states)
commonRunTest(label, tempTestDir, preHook, handlers, runner, states, buffer)
// Run reload inside the hook to reuse error handling for pending tests
val wrapHook = (file: File) => {
preHook(file)
runner.processStatement(sbtHandler.asInstanceOf[SbtHandler], statement, states)
}
commonRunTest(label, tempTestDir, wrapHook, handlers, runner, states, buffer)
}
// Run the test and delete files (except global that holds local scala jars)