Remove run2.8 test

This commit is contained in:
Eugene Yokota 2016-05-05 21:46:31 -04:00
parent 5d8b3e7dd9
commit 88f72b62d9
4 changed files with 0 additions and 60 deletions

View File

@ -1,5 +0,0 @@
scalaVersion := "2.8.1"
libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" % "test"
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _)

View File

@ -1,40 +0,0 @@
package foo.bar
import java.io.File
import File.{pathSeparator => / }
import scala.io.Source
class Holder { var value: Any = _ }
import scala.tools.nsc.{GenericRunnerSettings, Interpreter, Settings}
class Foo {
val g = new GenericRunnerSettings(System.err.println)
val settings = new Settings()
val loader = getClass.getClassLoader
settings.classpath.value = classpath("app", loader).getOrElse(error("Error: could not find application classpath"))
settings.bootclasspath.value = settings.bootclasspath.value + / + classpath("boot", loader).getOrElse(error("Error: could not find boot classpath"))
val inter = new Interpreter(settings) {
override protected def parentClassLoader = Foo.this.getClass.getClassLoader
}
def eval(code: String): Any = {
val h = new Holder
inter.bind("$r_", h.getClass.getName, h)
val r = inter.interpret("$r_.value = " + code)
h.value
}
private def classpath(name: String, loader: ClassLoader) =
Option(loader.getResource(name + ".class.path")).map { cp =>
Source.fromURL(cp).mkString
}
}
object Test
{
def main(args: Array[String])
{
val foo = new Foo
args.foreach { arg => foo.eval(arg) == arg.toInt }
}
}

View File

@ -1,14 +0,0 @@
package foo.bar
import org.specs._
class ATest extends Specification
{
"application and boot classpath" should {
"be provided to running applications and tests" in {
val foo = new Foo
val numbers = List[Any](1,2,5, 19)
numbers.map(i => foo.eval(i.toString)) must haveTheSameElementsAs(numbers)
}
}
}

View File

@ -1 +0,0 @@
> test:test