summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Zeiger <szeiger@novocode.com>2011-11-22 18:44:00 +0000
committerStefan Zeiger <szeiger@novocode.com>2011-11-22 18:44:00 +0000
commita17be60676ae8329672868872e33b65fa79cbe03 (patch)
tree40e6876b48a5138dfc77e105dc08a21bb62cdcdb /test
parentac031789039d421186567cf3b9a484957e6e5f8e (diff)
downloadscala-a17be60676ae8329672868872e33b65fa79cbe03.tar.gz
scala-a17be60676ae8329672868872e33b65fa79cbe03.tar.bz2
scala-a17be60676ae8329672868872e33b65fa79cbe03.zip
Make partest work with spaces in the path (from...
Make partest work with spaces in the path (from batch script and ant task). - The 'partest' ant task gets a new 'compilerargs' element for scalac - options (like in scalacfork and javac). Fixed argument list handling - in partest task. Further improvements to argument list handling for - all ant tasks. Fixed argument list handling in DirectTest (used by - partest shell scripts) Fixed path handling in several test cases. Closes SI-622. Review by phaller.
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/inner.scala8
-rw-r--r--test/scaladoc/scala/IndexScriptTest.scala4
-rw-r--r--test/scaladoc/scala/IndexTest.scala6
-rw-r--r--test/scaladoc/scala/html/HtmlFactoryTest.scala6
4 files changed, 12 insertions, 12 deletions
diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala
index 156d9e69a8..009d52e5bc 100644
--- a/test/files/jvm/inner.scala
+++ b/test/files/jvm/inner.scala
@@ -71,15 +71,15 @@ object Scalatest {
val tmpfile = new FileWriter(tmpfilename)
tmpfile.write(src)
tmpfile.close
- exec(javac + " -d " + outputdir + " -classpath " + classpath + " " + tmpfilename)
+ exec(javac, "-d", outputdir, "-classpath", classpath, tmpfilename)
}
def java(cname: String) =
- exec(javacmd + " -cp " + classpath + " " + cname)
+ exec(javacmd, "-cp", classpath, cname)
/** Execute cmd, wait for the process to end and pipe it's output to stdout */
- private def exec(cmd: String) {
- val proc = Runtime.getRuntime().exec(cmd)
+ private def exec(args: String*) {
+ val proc = Runtime.getRuntime().exec(args.toArray)
val inp = new BufferedReader(new InputStreamReader(proc.getInputStream))
val errp = new BufferedReader(new InputStreamReader(proc.getErrorStream))
proc.waitFor()
diff --git a/test/scaladoc/scala/IndexScriptTest.scala b/test/scaladoc/scala/IndexScriptTest.scala
index 991491c376..e0372020fd 100644
--- a/test/scaladoc/scala/IndexScriptTest.scala
+++ b/test/scaladoc/scala/IndexScriptTest.scala
@@ -3,7 +3,7 @@ import org.scalacheck.Prop._
import scala.tools.nsc.doc
import scala.tools.nsc.doc.html.page.IndexScript
-import java.net.URLClassLoader
+import java.net.{URLClassLoader, URLDecoder}
object Test extends Properties("IndexScript") {
@@ -11,7 +11,7 @@ object Test extends Properties("IndexScript") {
val loader = Thread.currentThread.getContextClassLoader
val paths = loader.asInstanceOf[URLClassLoader].getURLs
val morepaths = loader.getParent.asInstanceOf[URLClassLoader].getURLs
- (paths ++ morepaths).map(_.getPath).mkString(java.io.File.pathSeparator)
+ (paths ++ morepaths).map(u => URLDecoder.decode(u.getPath)).mkString(java.io.File.pathSeparator)
}
val docFactory = {
diff --git a/test/scaladoc/scala/IndexTest.scala b/test/scaladoc/scala/IndexTest.scala
index 2d731643da..c14fd98297 100644
--- a/test/scaladoc/scala/IndexTest.scala
+++ b/test/scaladoc/scala/IndexTest.scala
@@ -3,7 +3,7 @@ import org.scalacheck.Prop._
import scala.tools.nsc.doc
import scala.tools.nsc.doc.html.page.Index
-import java.net.URLClassLoader
+import java.net.{URLClassLoader, URLDecoder}
object Test extends Properties("Index") {
@@ -12,8 +12,8 @@ object Test extends Properties("Index") {
// this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths
// does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no.
// this test _will_ fail again some time in the future.
- val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(_.getPath)
- val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(_.getPath)
+ val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
+ val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
(paths ++ morepaths).mkString(java.io.File.pathSeparator)
}
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala
index 9d40996799..916fe2e42f 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.scala
+++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala
@@ -1,7 +1,7 @@
import org.scalacheck._
import org.scalacheck.Prop._
-import java.net.URLClassLoader
+import java.net.{URLClassLoader, URLDecoder}
object XMLUtil {
import scala.xml._
@@ -31,8 +31,8 @@ object Test extends Properties("HtmlFactory") {
// this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths
// does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no.
// this test _will_ fail again some time in the future.
- val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(_.getPath)
- val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(_.getPath)
+ val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
+ val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
(paths ++ morepaths).mkString(java.io.File.pathSeparator)
}