From ac75cc4b50822988532754310d99b4c251ac2566 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 19 Sep 2012 08:52:22 -0400 Subject: Additional OSGi tests. * Ensure scala-library can be resolved on its own, and with sun.misc.Unsafe usage. * Ensure reflection works without scala-compiler.jar * Ensure ToolBox's can see all classes necessary when evaluating expressions. * Cleanup test helper for filtering in/out bundles. --- test/osgi/src/ScalaOsgiHelper.scala | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'test/osgi/src/ScalaOsgiHelper.scala') diff --git a/test/osgi/src/ScalaOsgiHelper.scala b/test/osgi/src/ScalaOsgiHelper.scala index b4c643ef60..bcdc5c0df1 100644 --- a/test/osgi/src/ScalaOsgiHelper.scala +++ b/test/osgi/src/ScalaOsgiHelper.scala @@ -5,13 +5,31 @@ import org.ops4j.pax.exam import java.io.File trait ScalaOsgiHelper { - def scalaBundles: Array[exam.Option] = { + + private def allBundleFiles = { def bundleLocation = new File(sys.props.getOrElse("scala.bundle.dir", "build/osgi")) - def bundleFiles = bundleLocation.listFiles filter (_.getName endsWith ".jar") - def makeBundle(file: File): exam.Option = + bundleLocation.listFiles filter (_.getName endsWith ".jar") + } + + private def filteredBundleFiles(names: String*): Array[exam.Option] = + for(bundle <- allBundleFiles; if names exists (bundle.getName contains)) + yield makeBundle(bundle) + + private def makeBundle(file: File): exam.Option = bundle(file.toURI.toASCIIString) - val bundles = (bundleFiles map makeBundle) - System.out.println(bundles) + + def standardOptions: Array[exam.Option] = { + val bundles = (allBundleFiles map makeBundle) + bundles ++ Array[exam.Option](felix(), equinox(), junitBundles()) + } + + def justReflectionOptions: Array[exam.Option] = { + val bundles = filteredBundleFiles("scala-library", "scala-reflect") + bundles ++ Array[exam.Option](felix(), equinox(), junitBundles()) + } + + def justCoreLibraryOptions: Array[exam.Option] = { + val bundles = filteredBundleFiles("scala-library") bundles ++ Array[exam.Option](felix(), equinox(), junitBundles()) } -- cgit v1.2.3