update test for projects that use the compiler

This commit is contained in:
Mark Harrah 2010-04-24 22:41:55 -04:00
parent ee87e10a9f
commit 2e7c0cae48
4 changed files with 37 additions and 6 deletions

View File

@ -0,0 +1,8 @@
import sbt._
class P(info: ProjectInfo) extends DefaultProject(info)
{
val bryanjswift = "Bryan J Swift Repository" at "http://repos.bryanjswift.com/maven2/"
val junitInterface = "com.novocode" % "junit-interface" % "0.4.0" % "test"
val junit = "junit" % "junit" % "4.7" % "test"
}

View File

@ -1,18 +1,21 @@
package foo.bar
import java.io.File
import File.{pathSeparator => / }
import java.net.{URISyntaxException, URL}
class Holder { var value: Any = _ }
import scala.tools.nsc.{Interpreter, Settings}
import scala.tools.nsc.{GenericRunnerSettings, Interpreter, Settings}
class Foo {
val g = new GenericRunnerSettings(System.err.println)
val settings = new Settings()
settings.classpath.value = location(classOf[Holder])
settings.bootclasspath.value = settings.bootclasspath.value + File.pathSeparator + location(classOf[ScalaObject])
val inter = new Interpreter(settings)
settings.bootclasspath.value = settings.bootclasspath.value + / + location(classOf[ScalaObject]) + / + location(classOf[Settings])
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)
@ -32,4 +35,4 @@ object Test
val foo = new Foo
args.foreach { arg => foo.eval(arg) == arg.toInt }
}
}
}

View File

@ -0,0 +1,15 @@
package foo.bar
import org.junit._
import org.junit.Assert._
class Basic
{
val foo = new Foo
@Test
def checkBind(): Unit =
{
try { assertTrue( foo.eval("3") == 3) }
catch { case e => e.printStackTrace; throw e}
}
}

View File

@ -1,8 +1,13 @@
> set build.scala.versions 2.7.7 2.8.0.RC1
> reload
> +update
> +run 1
> +test
> +clean
> +run 2
> +test
> +clean
> +run -1
> +clean
> +test