summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/throws-annot-from-java.check8
-rw-r--r--test/files/presentation/callcc-interpreter.check11
-rw-r--r--test/files/run/class-symbol-contravariant.check8
-rw-r--r--test/files/run/constant-type.check8
-rw-r--r--test/files/run/repl-paste-2.check2
-rw-r--r--test/files/run/repl-power.check8
-rw-r--r--test/files/run/repl-transcript.check2
-rw-r--r--test/files/run/t4658.check7
-rw-r--r--test/files/run/t4658.scala11
-rw-r--r--test/files/run/t6146b.check8
-rw-r--r--test/files/run/t6439.check8
-rw-r--r--test/files/run/t7747-repl.check8
-rw-r--r--test/files/run/tpeCache-tyconCache.check8
-rw-r--r--test/files/scalacheck/range.scala17
-rw-r--r--test/junit/scala/collection/immutable/PagedSeqTest.scala6
-rw-r--r--test/junit/scala/collection/immutable/RangeConsistencyTest.scala24
-rw-r--r--test/junit/scala/tools/nsc/interpreter/CompletionTest.scala161
-rwxr-xr-xtest/partest1
-rwxr-xr-xtest/partest.bat104
19 files changed, 258 insertions, 152 deletions
diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check
index ace264a4f5..bf639260e7 100644
--- a/test/files/jvm/throws-annot-from-java.check
+++ b/test/files/jvm/throws-annot-from-java.check
@@ -1,10 +1,8 @@
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> :paste
// Entering paste mode (ctrl-D to finish)
diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check
index 4bf68b3d4e..94a3d64d68 100644
--- a/test/files/presentation/callcc-interpreter.check
+++ b/test/files/presentation/callcc-interpreter.check
@@ -3,7 +3,7 @@ reload: CallccInterpreter.scala
askTypeCompletion at CallccInterpreter.scala(51,34)
================================================================================
[response] askTypeCompletion at (51,34)
-retrieved 57 members
+retrieved 66 members
abstract trait Term extends AnyRef
abstract trait Value extends AnyRef
case class Add extends callccInterpreter.Term with Product with Serializable
@@ -50,6 +50,15 @@ final def synchronized[T0](x$1: T0): T0
final def wait(): Unit
final def wait(x$1: Long): Unit
final def wait(x$1: Long,x$2: Int): Unit
+object Add
+object App
+object Ccc
+object Con
+object Fun
+object Lam
+object M
+object Num
+object Var
private[this] val term0: callccInterpreter.App
private[this] val term1: callccInterpreter.App
private[this] val term2: callccInterpreter.Add
diff --git a/test/files/run/class-symbol-contravariant.check b/test/files/run/class-symbol-contravariant.check
index 1d95273b50..5166fce96a 100644
--- a/test/files/run/class-symbol-contravariant.check
+++ b/test/files/run/class-symbol-contravariant.check
@@ -1,10 +1,8 @@
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> val u = rootMirror.universe
u: $r.intp.global.type = <global>
diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check
index b92f1481a3..9df1353354 100644
--- a/test/files/run/constant-type.check
+++ b/test/files/run/constant-type.check
@@ -1,10 +1,8 @@
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> val s = transformedType(StringClass.toType).asInstanceOf[Type]
s: $r.intp.global.Type = String
diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check
index dbf5363c0f..4c589df41a 100644
--- a/test/files/run/repl-paste-2.check
+++ b/test/files/run/repl-paste-2.check
@@ -1,7 +1,7 @@
scala> scala> 999l
-// Detected repl transcript paste: ctrl-D to finish.
+// Detected repl transcript. Paste more, or ctrl-D to finish.
res4: Int = 0123
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index 4e030bd9fa..0d4a30b8e3 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -1,10 +1,8 @@
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> // guarding against "error: reference to global is ambiguous"
diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check
index 762a96b9cc..d0b455cbf6 100644
--- a/test/files/run/repl-transcript.check
+++ b/test/files/run/repl-transcript.check
@@ -1,7 +1,7 @@
scala> scala> class Bippity
-// Detected repl transcript paste: ctrl-D to finish.
+// Detected repl transcript. Paste more, or ctrl-D to finish.
defined class Bippity
diff --git a/test/files/run/t4658.check b/test/files/run/t4658.check
index bb6405175e..3bc52daef3 100644
--- a/test/files/run/t4658.check
+++ b/test/files/run/t4658.check
@@ -1,5 +1,5 @@
Ranges:
-1073741824
+-1073741824
1073741824
0
0
@@ -20,7 +20,7 @@ Ranges:
-10
IntRanges:
-1073741824
--1073741824
+1073741824
0
0
55
@@ -78,3 +78,6 @@ BigIntRanges:
-24
-30
-10
+BigInt agrees with Long: true
+Long agrees with Int when rounded: true
+Numeric Int agrees with Range: true
diff --git a/test/files/run/t4658.scala b/test/files/run/t4658.scala
index 8c07c50694..7fc6d4584c 100644
--- a/test/files/run/t4658.scala
+++ b/test/files/run/t4658.scala
@@ -2,6 +2,7 @@ import scala.collection.immutable.NumericRange
//#4658
object Test {
+ // Only works for Int values! Need to rethink explicit otherwise.
case class R(start: Int, end: Int, step: Int = 1, inclusive: Boolean = true)
val rangeData = Array(
@@ -28,6 +29,14 @@ object Test {
numericLongRanges.foreach{range => println(range.sum)}
println("BigIntRanges:")
numericBigIntRanges.foreach{range => println(range.sum)}
+ println("BigInt agrees with Long: " +
+ (numericLongRanges zip numericBigIntRanges).forall{ case (lr, bir) => lr.sum == bir.sum }
+ )
+ println("Long agrees with Int when rounded: " +
+ (numericLongRanges zip numericIntRanges).forall{ case (lr, ir) => lr.sum.toInt == ir.sum }
+ )
+ println("Numeric Int agrees with Range: " +
+ (numericIntRanges zip ranges).forall{ case (ir, r) => ir.sum == r.sum }
+ )
}
-
} \ No newline at end of file
diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check
index 0e0c216cd7..11149c50fd 100644
--- a/test/files/run/t6146b.check
+++ b/test/files/run/t6146b.check
@@ -4,11 +4,9 @@ It would fail on the following inputs: S2(), S3()
^
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> val u = rootMirror.universe; import u._, language._
u: $r.intp.global.type = <global>
diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check
index eee2da1b12..dd7ba9f81d 100644
--- a/test/files/run/t6439.check
+++ b/test/files/run/t6439.check
@@ -48,11 +48,9 @@ scala> type F = Int // no warn
defined type alias F
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> object lookup {
import intp._
diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check
index 487daf4878..d698ea668d 100644
--- a/test/files/run/t7747-repl.check
+++ b/test/files/run/t7747-repl.check
@@ -295,11 +295,9 @@ scala> b(a)
res4: String = Found Sum
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala> intp.lastRequest
res5: $r.intp.Request = Request(line=def $ires3 = intp.global, 1 trees)
diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check
index ac13d32f91..b26f1ab8a1 100644
--- a/test/files/run/tpeCache-tyconCache.check
+++ b/test/files/run/tpeCache-tyconCache.check
@@ -1,10 +1,8 @@
scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
+Power mode enabled. :phase is at typer.
+import scala.tools.nsc._, intp.global._, definitions._
+Try :help or completions for vals._ and power._
scala>
diff --git a/test/files/scalacheck/range.scala b/test/files/scalacheck/range.scala
index 493083a51f..ac24b52f8d 100644
--- a/test/files/scalacheck/range.scala
+++ b/test/files/scalacheck/range.scala
@@ -134,7 +134,22 @@ abstract class RangeTest(kind: String) extends Properties("Range "+kind) {
val expected = r.length match {
case 0 => 0
case 1 => r.head
- case _ => ((r.head + r.last).toLong * r.length / 2).toInt
+ case x if x < 1000 =>
+ // Explicit sum, to guard against having the same mistake in both the
+ // range implementation and test implementation of sum formula.
+ // (Yes, this happened before.)
+ var i = r.head
+ var s = 0L
+ var n = x
+ while (n > 0) {
+ s += i
+ i += r.step
+ n -= 1
+ }
+ s.toInt
+ case _ =>
+ // Make sure head + last doesn't overflow!
+ ((r.head.toLong + r.last) * r.length / 2).toInt
}
// println("size: " + r.length)
// println("expected: " + expected)
diff --git a/test/junit/scala/collection/immutable/PagedSeqTest.scala b/test/junit/scala/collection/immutable/PagedSeqTest.scala
index 2b576a3655..74f8825307 100644
--- a/test/junit/scala/collection/immutable/PagedSeqTest.scala
+++ b/test/junit/scala/collection/immutable/PagedSeqTest.scala
@@ -13,6 +13,12 @@ class PagedSeqTest {
assertEquals(Seq('a'), PagedSeq.fromStrings(List.fill(5000)("a")).slice(4096, 4097))
}
+ // should not NPE, and should be empty
+ @Test
+ def test_SI9480(): Unit = {
+ assertEquals(Seq(), PagedSeq.fromStrings(List("a")).slice(1))
+ }
+
// Slices shouldn't read outside where they belong
@Test
def test_SI6519 {
diff --git a/test/junit/scala/collection/immutable/RangeConsistencyTest.scala b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala
index 135796979d..760498c162 100644
--- a/test/junit/scala/collection/immutable/RangeConsistencyTest.scala
+++ b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala
@@ -148,4 +148,28 @@ class RangeConsistencyTest {
val bdRange = bd(-10.0) until bd(0.0) by bd(4.5)
assert( bdRange sameElements List(bd(-10.0), bd(-5.5), bd(-1.0)) )
}
+
+ @Test
+ def test_SI9388() {
+ val possiblyNotDefaultNumeric = new scala.math.Numeric[Int] {
+ def fromInt(x: Int) = x
+ def minus(x: Int, y: Int): Int = x - y
+ def negate(x: Int): Int = -x
+ def plus(x: Int, y: Int): Int = x + y
+ def times(x: Int, y: Int): Int = x*y
+ def toDouble(x: Int): Double = x.toDouble
+ def toFloat(x: Int): Float = x.toFloat
+ def toInt(x: Int): Int = x
+ def toLong(x: Int): Long = x.toLong
+ def compare(x: Int, y: Int) = x compare y
+ }
+ val r = (Int.MinValue to Int.MaxValue by (1<<23))
+ val nr = NumericRange(Int.MinValue, Int.MaxValue, 1 << 23)
+ assert({ var i = 0; r.foreach(_ => i += 1); i } == 512)
+ assert({ var i = 0; nr.foreach(_ => i += 1); i } == 512)
+ assert(r.sum == Int.MinValue)
+ assert(nr.sum == Int.MinValue)
+ assert(r.sum(possiblyNotDefaultNumeric) == Int.MinValue)
+ assert(nr.sum(possiblyNotDefaultNumeric) == Int.MinValue)
+ }
}
diff --git a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
new file mode 100644
index 0000000000..514f30571e
--- /dev/null
+++ b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
@@ -0,0 +1,161 @@
+package scala.tools.nsc.interpreter
+
+import java.io.{StringWriter, PrintWriter}
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+import scala.tools.nsc.Settings
+
+class CompletionTest {
+ val EmptyString = "" // def string results include the empty string so that JLine won't insert "def ..." at the cursor
+
+ def newIMain(): IMain = {
+ val settings = new Settings()
+ settings.Xnojline.value = true
+ settings.usejavacp.value = true
+
+ val writer = new StringWriter
+ val out = new PrintWriter(writer)
+ new IMain(settings, out)
+ }
+ @Test
+ def t4438_arrayCompletion(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ assert(completer.complete("Array(1, 2, 3) rev").candidates.contains("reverseMap"))
+ }
+
+ @Test
+ def completions(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "object O { def x_y_z = 1 }; import O._; x_y")("x_y_z")
+ checkExact(completer, "object O { private def x_y_z = 1 }; import O._; x_y")()
+ checkExact(completer, "object O { private def x_y_z = 1; x_y", "}")("x_y_z")
+ checkExact(completer, "object x_y_z; import x_y")("x_y_z")
+
+ checkExact(completer, "object x_y_z { def a_b_c }; import x_y_z.a_b")("a_b_c")
+
+ checkExact(completer, "object X { private[this] def definition = 0; def")("definition")
+
+ // stable terms are offered in type completion as they might be used as a prefix
+ checkExact(completer, """object O { def x_y_z = 0; val x_z_y = ""; type T = x_""")("x_z_y")
+ checkExact(completer, """def method { def x_y_z = 0; val x_z_y = ""; type T = x_""")("x_z_y")
+
+ // We exclude inherited members of the synthetic interpreter wrapper classes
+ checkExact(completer, """asInstanceO""")()
+ checkExact(completer, """class C { asInstanceO""")("asInstanceOf")
+
+ // Output is sorted
+ assertEquals(List("prefix_aaa", "prefix_nnn", "prefix_zzz"), completer.complete( """class C { def prefix_nnn = 0; def prefix_zzz = 0; def prefix_aaa = 0; prefix_""").candidates)
+ }
+
+ @Test
+ def symbolically(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, """class C { def +++(a: Any) = 0; def ---(a: Any) = 0; this.++""")("+++")
+ }
+
+ @Test
+ def camelCompletions(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; tCSO")("theCatSatOnTheMat")
+ checkExact(completer, "object O { def getBlerganator = 1 }; import O._; blerga")("getBlerganator")
+ checkExact(completer, "object O { def xxxxYyyyyZzzz = 1; def xxxxYyZeee = 1 }; import O._; xYZ")("", "xxxxYyyyyZzzz", "xxxxYyZeee")
+ checkExact(completer, "object O { def xxxxYyyyyZzzz = 1; def xxxxYyyyyZeee = 1 }; import O._; xYZ")("xxxxYyyyyZzzz", "xxxxYyyyyZeee")
+ checkExact(completer, "object O { class AbstractMetaFactoryFactory }; new O.AMFF")("AbstractMetaFactoryFactory")
+ }
+
+ @Test
+ def lenientCamelCompletions(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; tcso")("theCatSatOnTheMat")
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; sotm")("theCatSatOnTheMat")
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; TCSOTM")()
+ }
+
+ @Test
+ def previousLineCompletions(): Unit = {
+ val intp = newIMain()
+ intp.interpret("class C { val x_y_z = 42 }")
+ intp.interpret("object O { type T = Int }")
+
+ val completer = new PresentationCompilerCompleter(intp)
+
+ checkExact(completer, "new C().x_y")("x_y_z")
+ checkExact(completer, "(1 : O.T).toCha")("toChar")
+
+ intp.interpret("case class X_y_z()")
+ val completer1 = new PresentationCompilerCompleter(intp)
+ checkExact(completer1, "new X_y_")("X_y_z")
+ checkExact(completer1, "X_y_")("X_y_z")
+ checkExact(completer1, "X_y_z.app")("apply")
+ }
+
+ @Test
+ def previousResultInvocation(): Unit = {
+ val intp = newIMain()
+ intp.interpret("1 + 1")
+
+ val completer = new PresentationCompilerCompleter(intp)
+
+ checkExact(completer, ".toCha")("toChar")
+ }
+
+ @Test
+ def defString(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+
+ // Double Tab on a fully typed selection shows the def string
+ checkExact(completer, "(p: {def a_b_c: Int}) => p.a_b_c")()
+ checkExact(completer, "(p: {def a_b_c: Int}) => p.a_b_c")(EmptyString, "def a_b_c: Int")
+
+ // likewise for an ident
+ checkExact(completer, "(p: {def x_y_z: Int}) => {import p._; x_y_z")()
+ checkExact(completer, "(p: {def x_y_z: Int}) => {import p._; x_y_z")(EmptyString, "def x_y_z: Int")
+
+ // If the first completion only gives one alternative
+ checkExact(completer, "(p: {def x_y_z: Int; def x_y_z(a: String): Int }) => p.x_y")("x_y_z")
+ // ... it is automatically inserted into the buffer. Hitting <TAB> again is triggers the help
+ checkExact(completer, "(p: {def x_y_z: Int; def x_y_z(a: String): Int }) => p.x_y_z")(EmptyString, "def x_y_z(a: String): Int", "def x_y_z: Int")
+
+ checkExact(completer, "(p: {def x_y_z: Int; def x_z_y(a: String): Int }) => p.x_")("x_y_z", "x_z_y")
+ // By contrast, in this case the user had to type "y_z" manually, so no def string printing just yet
+ checkExact(completer, "(p: {def x_y_z: Int; def x_z_y(a: String): Int }) => p.x_y_z")()
+ // Another <TAB>, Okay, time to print.
+ checkExact(completer, "(p: {def x_y_z: Int; def x_z_y(a: String): Int }) => p.x_y_z")(EmptyString, "def x_y_z: Int")
+
+ // The def string reconstructs the source-level modifiers (rather than showing the desugarings of vals),
+ // and performs as-seen-from with respect to the prefix
+ checkExact(completer, "trait T[A]{ lazy val x_y_z: A }; class C extends T[Int] { x_y_z")()
+ checkExact(completer, "trait T[A]{ lazy val x_y_z: A }; class C extends T[Int] { x_y_z")(EmptyString, "lazy val x_y_z: Int")
+
+ checkExact(completer, "trait T[A] { def foo: A }; (t: T[Int]) => t.foo")()
+ checkExact(completer, "trait T[A] { def foo: A }; (t: T[Int]) => t.foo")(EmptyString, "def foo: Int")
+ }
+
+ @Test
+ def treePrint(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, " 1.toHexString //print")(EmptyString, "scala.Predef.intWrapper(1).toHexString // : String")
+ }
+
+ @Test
+ def firstCompletionWithNoPrefixHidesUniversalMethodsAndExtensionMethods(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "class C(val a: Int, val b: Int) { this.")("a", "b")
+ assert(Set("asInstanceOf", "==").diff(completer.complete("class C(val a: Int, val b: Int) { this.").candidates.toSet).isEmpty)
+ checkExact(completer, "case class D(a: Int, b: Int) { this.a")("a", "asInstanceOf")
+ }
+
+ def checkExact(completer: PresentationCompilerCompleter, before: String, after: String = "")(expected: String*): Unit = {
+ assertEquals(expected.toSet, completer.complete(before, after).candidates.toSet)
+ }
+}
diff --git a/test/partest b/test/partest
index 7e19c92165..6f14dfe1bc 100755
--- a/test/partest
+++ b/test/partest
@@ -112,7 +112,6 @@ if $cygwin; then
JAVAC_CMD=`cygpath --$format "$JAVAC_CMD"`
fi
SCALA_HOME=`cygpath --$format "$SCALA_HOME"`
- PARTEST_CLASSPATH=`cygpath --path --$format "$PARTEST_CLASSPATH"`
fi
# last arg wins, so if JAVA_OPTS already contains -Xmx or -Xms the
diff --git a/test/partest.bat b/test/partest.bat
deleted file mode 100755
index 1806e80888..0000000000
--- a/test/partest.bat
+++ /dev/null
@@ -1,104 +0,0 @@
-@echo off
-
-rem ##########################################################################
-rem # Scala code runner 2.9.1.final
-rem ##########################################################################
-rem # (c) 2002-2013 LAMP/EPFL
-rem #
-rem # This is free software; see the distribution for copying conditions.
-rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
-rem # PARTICULAR PURPOSE.
-rem ##########################################################################
-
-rem We adopt the following conventions:
-rem - System/user environment variables start with a letter
-rem - Local batch variables start with an underscore ('_')
-
-if "%OS%"=="Windows_NT" (
- @setlocal
- call :set_home
- set _ARGS=%*
-) else (
- set _SCALA_HOME="%SCALA_HOME%"
- rem The following line tests SCALA_HOME instead of _SCALA_HOME, because
- rem the above change to _SCALA_HOME is not visible within this block.
- if "%SCALA_HOME%"=="" goto error1
- call :set_args
-)
-
-rem We use the value of the JAVACMD environment variable if defined
-set _JAVACMD=%JAVACMD%
-if "%_JAVACMD%"=="" set _JAVACMD=java
-
-rem We use the value of the JAVACCMD environment variable if defined
-set _JAVACCMD=%JAVACCMD%
-if "%_JAVACCMD%"=="" set _JAVACCMD=javac
-
-rem We use the value of the JAVA_OPTS environment variable if defined
-set _JAVA_OPTS=%JAVA_OPTS%
-if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=-Xmx1024M -Xms64M
-
-rem We use the value of the SCALAC_OPTS environment variable if defined
-set _SCALAC_OPTS=%SCALAC_OPTS%
-if "%_SCALAC_OPTS%"=="" set _SCALAC_OPTS=-deprecation
-
-set _EXTENSION_CLASSPATH=
-if "%_EXTENSION_CLASSPATH%"=="" (
- if exist "%_SCALA_HOME%\lib\scala-partest.jar" (
- for %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
- if "%OS%"=="Windows_NT" (
- for /d %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
- )
- ) else if exist "%_SCALA_HOME%\build\pack\lib\scala-partest.jar" (
- for %%f in ("%_SCALA_HOME%\build\pack\lib\*") do call :add_cpath "%%f"
- if "%OS%"=="Windows_NT" (
- for /d %%f in ("%_SCALA_HOME%\build\pack\lib\*") do call :add_cpath "%%f"
- )
- )
-)
-
-set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dpartest.javacmd="%_JAVACMD%" -Dpartest.java_options="%_JAVA_OPTS%" -Dpartest.scalac_options="%_SCALAC_OPTS%" -Dpartest.javac_cmd="%_JAVACCMD%"
-
-rem echo %_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%
-%_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%
-goto end
-
-rem ##########################################################################
-rem # subroutines
-
-:add_cpath
- if "%_EXTENSION_CLASSPATH%"=="" (
- set _EXTENSION_CLASSPATH=%~1
- ) else (
- set _EXTENSION_CLASSPATH=%_EXTENSION_CLASSPATH%;%~1
- )
-goto :eof
-
-rem Variable "%~dps0" works on WinXP SP2 or newer
-rem (see http://support.microsoft.com/?kbid=833431)
-rem set _SCALA_HOME=%~dps0..
-:set_home
- set _BIN_DIR=
- for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi
- set _SCALA_HOME=%_BIN_DIR%..
-goto :eof
-
-:set_args
- set _ARGS=
- :loop
- rem Argument %1 may contain quotes so we use parentheses here
- if (%1)==() goto :eof
- set _ARGS=%_ARGS% %1
- shift
- goto loop
-
-rem ##########################################################################
-rem # errors
-
-:error1
-echo ERROR: environment variable SCALA_HOME is undefined. It should point to your installation directory.
-goto end
-
-:end
-if "%OS%"=="Windows_NT" @endlocal
-exit /b %errorlevel%