Skip to content

Commit 7238bc1

Browse files
committed
Make nsc.Global based tests work under SBT
And remove unused code.
1 parent 5bb93b0 commit 7238bc1

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/test/scala/scala/async/package.scala

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,12 @@ package object async {
5353

5454
import scala.tools.nsc._, reporters._
5555
def mkGlobal(compileOptions: String = ""): Global = {
56-
val source = """
57-
| class Test {
58-
| def test = {
59-
| import scala.async.Async._, scala.concurrent._, ExecutionContext.Implicits.global
60-
| async {
61-
| val opt = await(async(Option.empty[String => Future[Unit]]))
62-
| opt match {
63-
| case None =>
64-
| throw new RuntimeException("case a")
65-
| case Some(f) =>
66-
| await(f("case b"))
67-
| }
68-
| }
69-
| }
70-
| }
71-
| """.stripMargin
7256
val settings = new Settings()
7357
settings.processArgumentString(compileOptions)
74-
settings.usejavacp.value = true
58+
val initClassPath = settings.classpath.value
7559
settings.embeddedDefaults(getClass.getClassLoader)
60+
if (initClassPath == settings.classpath.value)
61+
settings.usejavacp.value = true // not running under SBT, try to use the Java claspath instead
7662
val reporter = new StoreReporter
7763
new Global(settings, reporter)
7864
}

0 commit comments

Comments
 (0)