summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
authorStefan Zeiger <szeiger@novocode.com>2015-10-27 14:07:52 +0100
committerStefan Zeiger <szeiger@novocode.com>2015-12-04 16:22:24 -0800
commit780ac4124a5bf34a3297b563fa4ea09741aa2d7b (patch)
treef677bc74a7a5c805a996d6c9e4347cb3dd895bc1 /test/files/jvm
parent9fb965e4ef22019dcbd0f7441576df354bb1feb8 (diff)
downloadscala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.tar.gz
scala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.tar.bz2
scala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.zip
Make all of partest work in the sbt build
- Fix the scoping of files/lib/*.jar. These files were not on the classpath when running partest from sbt. - Pass the same standard Java options to partest as from the command line. This requires new versions of scala-partest and scala-partest-interface. - Fix the classpath scanning in jvm/innerClassEnclMethodJavaReflection. It only worked for JARs and relative directories but not for absolute directory paths (which are produced by sbt).
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/innerClassEnclMethodJavaReflection.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/files/jvm/innerClassEnclMethodJavaReflection.scala b/test/files/jvm/innerClassEnclMethodJavaReflection.scala
index a4d64d0b67..a60b5cac8e 100644
--- a/test/files/jvm/innerClassEnclMethodJavaReflection.scala
+++ b/test/files/jvm/innerClassEnclMethodJavaReflection.scala
@@ -25,12 +25,13 @@ object Test extends App {
def testClasses(jarOrDirectory: String): Unit = {
val classPath = AbstractFile.getDirectory(new java.io.File(jarOrDirectory))
+ val basePath = classPath.path + "/"
- def flatten(f: AbstractFile): Iterator[AbstractFile] =
- if (f.isClassContainer) f.iterator.flatMap(flatten)
- else Iterator(f)
+ def flatten(f: AbstractFile, s: String): Iterator[(AbstractFile, String)] =
+ if (f.isClassContainer) f.iterator.map(ch => (ch, (if(s.isEmpty) "" else s + "/") + ch.name)).flatMap((flatten _).tupled)
+ else Iterator((f, s))
- val classFullNames = flatten(classPath).filter(_.hasExtension("class")).map(_.path.replace("/", ".").replaceAll(".class$", ""))
+ val classFullNames = flatten(classPath, "").filter(_._1.hasExtension("class")).map(_._2.replace("/", ".").replaceAll(".class$", ""))
// it seems that Class objects can only be GC'd together with their class loader
// (http://stackoverflow.com/questions/2433261/when-and-how-are-classes-garbage-collected-in-java)