2
** ________ ___ / / ___ Scala Parallel Testing **
3
** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
4
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
5
** /____/\___/_/ |_/____/_/ | | **
14
import nsc.util.{ ClassPath }
19
trait TestCategory extends AbsTestCategory {
21
def startMessage: String = "Executing test group"
22
def testSequence: TestSequence
24
class TestSettings(entity: TestEntity, error: String => Unit) extends Settings(error) {
25
def this(entity: TestEntity) = this(entity, Console println _)
27
deprecation.value = false
28
encoding.value = "ISO-8859-1"
29
classpath.value = entity.testClasspath
30
outdir.value = entity.outDir.path
33
def createSettings(entity: TestEntity): TestSettings = new TestSettings(entity)
34
def createTest(location: Path): TestEntity =
35
if (location.isFile) TestFile(this, location.toFile)
36
else if (location.isDirectory) TestDirectory(this, location.toDirectory)
37
else error("Failed to create test at '%s'" format location)
39
/** Category test identification.
41
def denotesTestFile(p: Path) = p.isFile && (p hasExtension "scala")
42
def denotesTestDir(p: Path) = p.isDirectory && !ignorePath(p)
43
def denotesTest(p: Path) = denotesTestDir(p) || denotesTestFile(p)
45
/** This should verify that all necessary files are present.
46
* By default it delegates to denotesTest.
48
def denotesValidTest(p: Path) = denotesTest(p)
51
abstract class DirBasedCategory(val kind: String) extends TestCategory with CategoryContribution {
52
lazy val root = Directory(src / kind).normalize
53
def enumerate = root.list filter denotesTest map createTest toList
55
/** Standard actions. These can be overridden either on the
56
* Category level or by individual tests.
58
def compile: TestStep = (_: TestEntity).compile()
59
def checkFileRequired: TestStep = (_: TestEntity).checkFileRequired
60
def diff: TestStep = (_: TestEntity).diff()
61
def run: TestStep = (_: TestEntity).run()
62
def exec: TestStep = (_: TestEntity).exec()
66
def not(f: TestStep): TestStep = !f(_: TestEntity)
68
override def toString = kind
b'\\ No newline at end of file'