blob: f855cf6ebc9bb67445a4243a5da533567d97f5d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* __ *\
** ________ ___ / / ___ __ ____ Scala.js API **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ **
** /____/\___/_/ |_/____/_/ | |__/ /____/ **
** |/____/ **
\* */
package scala.scalajs.testbridge
import scala.scalajs.js
import js.annotation.{ JSExportDescendentObjects, JSExport }
/** This trait should be sub classed (as object) by a concrete test framework
*
* It will receive a call to runTest for each object on the classpath
* extending Test
*/
@JSExportDescendentObjects
trait TestFramework {
@JSExport
final def safeRunTest(testOutput: TestOutput, args: js.Array[String])(
test: js.Function0[Test]): Unit = {
try {
runTest(testOutput, args)(test)
} catch {
case e: Throwable =>
testOutput.error(s"Test framework ${getClass.getName} failed:")
testOutput.error(e.getMessage, e.getStackTrace)
}
}
def runTest(testOutput: TestOutput, args: js.Array[String])(
test: js.Function0[Test]): Unit
}
|