mirror of https://github.com/sbt/sbt.git
Remove run2.8 test
This commit is contained in:
parent
5d8b3e7dd9
commit
88f72b62d9
|
|
@ -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" % _)
|
||||
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> test:test
|
||||
Loading…
Reference in New Issue