mirror of https://github.com/sbt/sbt.git
update test for projects that use the compiler
This commit is contained in:
parent
ee87e10a9f
commit
2e7c0cae48
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import File.{pathSeparator => / }
|
||||||
import java.net.{URISyntaxException, URL}
|
import java.net.{URISyntaxException, URL}
|
||||||
|
|
||||||
class Holder { var value: Any = _ }
|
class Holder { var value: Any = _ }
|
||||||
|
|
||||||
import scala.tools.nsc.{Interpreter, Settings}
|
import scala.tools.nsc.{GenericRunnerSettings, Interpreter, Settings}
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
|
val g = new GenericRunnerSettings(System.err.println)
|
||||||
val settings = new Settings()
|
val settings = new Settings()
|
||||||
settings.classpath.value = location(classOf[Holder])
|
settings.classpath.value = location(classOf[Holder])
|
||||||
settings.bootclasspath.value = settings.bootclasspath.value + File.pathSeparator + location(classOf[ScalaObject])
|
settings.bootclasspath.value = settings.bootclasspath.value + / + location(classOf[ScalaObject]) + / + location(classOf[Settings])
|
||||||
val inter = new Interpreter(settings)
|
val inter = new Interpreter(settings) {
|
||||||
|
override protected def parentClassLoader = Foo.this.getClass.getClassLoader
|
||||||
|
}
|
||||||
def eval(code: String): Any = {
|
def eval(code: String): Any = {
|
||||||
val h = new Holder
|
val h = new Holder
|
||||||
inter.bind("$r_", h.getClass.getName, h)
|
inter.bind("$r_", h.getClass.getName, h)
|
||||||
|
|
@ -32,4 +35,4 @@ object Test
|
||||||
val foo = new Foo
|
val foo = new Foo
|
||||||
args.foreach { arg => foo.eval(arg) == arg.toInt }
|
args.foreach { arg => foo.eval(arg) == arg.toInt }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
|
> set build.scala.versions 2.7.7 2.8.0.RC1
|
||||||
|
> reload
|
||||||
|
> +update
|
||||||
> +run 1
|
> +run 1
|
||||||
|
> +test
|
||||||
> +clean
|
> +clean
|
||||||
|
|
||||||
> +run 2
|
> +run 2
|
||||||
|
> +test
|
||||||
> +clean
|
> +clean
|
||||||
|
|
||||||
> +run -1
|
> +run -1
|
||||||
> +clean
|
> +test
|
||||||
Loading…
Reference in New Issue