Skip to content

Commit e4a9e67

Browse files
committed
Make nsc.Global based tests work under SBT
And remove unused code. (cherry picked from commit 7238bc1)
1 parent 02b2b8c commit e4a9e67

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
@@ -44,26 +44,12 @@ package object async {
4444

4545
import scala.tools.nsc._, reporters._
4646
def mkGlobal(compileOptions: String = ""): Global = {
47-
val source = """
48-
| class Test {
49-
| def test = {
50-
| import scala.async.Async._, scala.concurrent._, ExecutionContext.Implicits.global
51-
| async {
52-
| val opt = await(async(Option.empty[String => Future[Unit]]))
53-
| opt match {
54-
| case None =>
55-
| throw new RuntimeException("case a")
56-
| case Some(f) =>
57-
| await(f("case b"))
58-
| }
59-
| }
60-
| }
61-
| }
62-
| """.stripMargin
6347
val settings = new Settings()
6448
settings.processArgumentString(compileOptions)
65-
settings.usejavacp.value = true
49+
val initClassPath = settings.classpath.value
6650
settings.embeddedDefaults(getClass.getClassLoader)
51+
if (initClassPath == settings.classpath.value)
52+
settings.usejavacp.value = true // not running under SBT, try to use the Java claspath instead
6753
val reporter = new StoreReporter
6854
new Global(settings, reporter)
6955
}

0 commit comments

Comments
 (0)