summaryrefslogblamecommitdiff
path: root/src/partest-extras/scala/tools/partest/ScriptTest.scala
blob: 3000d751e1cc73f79967c790aece828663506e25 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                               
                              

                
                                                                 

   
/* NSC -- new Scala compiler
 * Copyright 2005-2013 LAMP/EPFL
 */

package scala.tools.partest

import scala.reflect.internal.util.ScalaClassLoader

/** A `ScriptTest` is a `DirectTest` for which the code
 *  is the contents of a script file.
 */
abstract class ScriptTest extends DirectTest {
  def testmain = "TestMain"
  override def extraSettings = s"-usejavacp -Xscript $testmain"
  def scriptPath = testPath changeExtension "script"
  def code = scriptPath.toFile.slurp
  def argv = Seq.empty[String]
  def show() = {
    compile()
    ScalaClassLoader(getClass.getClassLoader).run(testmain, argv)
  }
}