1/*
2 * Copyright 2001-2008 Artima, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.scalatest.tools
17
18import org.scalatest.FunSuite
19import org.scalatools.testing.Logger
20
21class ScalaTestFrameworkSuite extends FunSuite{
22
23  test("framework name"){
24    assert(new ScalaTestFramework().name === "ScalaTest")
25  }
26
27  test("tests contains single test fingerprint"){
28    val framework = new ScalaTestFramework
29    val fingerprints = framework.tests
30    assert(fingerprints.size === 1)
31
32    val fingerprint =
33      fingerprints(0).asInstanceOf[org.scalatools.testing.TestFingerprint]
34
35    assert(fingerprint.isModule === false)
36    assert(fingerprint.superClassName === "org.scalatest.Suite")
37  }
38
39  test("creates runner with given arguments"){
40    val framework = new ScalaTestFramework
41
42    import framework.ScalaTestRunner
43
44    val loggers: Array[Logger] = Array(new TestLogger)
45    val runner = framework.testRunner(currentThread.getContextClassLoader, loggers).asInstanceOf[ScalaTestRunner]
46    assert(runner.testLoader == currentThread.getContextClassLoader)
47    assert(runner.loggers === loggers)
48  }
49
50  class TestLogger extends Logger{
51    def trace(t:Throwable){}
52    def error(msg:String){}
53    def warn(msg:String){}
54    def info(msg:String){}
55    def debug(msg:String){}
56    def ansiCodesSupported = false
57  }
58}
59