summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-04-24 15:50:45 -0700
committerPaul Phillips <paulp@improving.org>2013-04-30 08:18:22 -0700
commitbf4466982854ffa8be57068752ea31daf7776eee (patch)
tree46cd3a6276d8fa3df9ccb7d730c29b1cf825edc2 /test/scaladoc
parentb47ca5b17ec8079a23d48103c6af295c2f01caf3 (diff)
downloadscala-bf4466982854ffa8be57068752ea31daf7776eee.tar.gz
scala-bf4466982854ffa8be57068752ea31daf7776eee.tar.bz2
scala-bf4466982854ffa8be57068752ea31daf7776eee.zip
SI-7349 Partest supports test-interface
Partest uses test-interface API to invoke ScalaCheck. This obviates ad hoc output checking for result status. The context class loader is set to a loader that the scaladoc scalacheck tests can use.
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/scalacheck/CommentFactoryTest.scala2
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala17
-rw-r--r--test/scaladoc/scalacheck/IndexScriptTest.scala14
-rw-r--r--test/scaladoc/scalacheck/IndexTest.scala12
4 files changed, 28 insertions, 17 deletions
diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala
index 96174d29d1..28043e5a06 100644
--- a/test/scaladoc/scalacheck/CommentFactoryTest.scala
+++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala
@@ -45,7 +45,7 @@ object Test extends Properties("CommentFactory") {
with MemberLookup)
}
- def parse(src: String, dst: Inline) = {
+ def parse(src: String, dst: Inline): Boolean = {
factory.parseComment(src) match {
case Some(inline) =>
inline == dst
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index d7b5e48288..03348b81d2 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -2,6 +2,8 @@ import org.scalacheck._
import org.scalacheck.Prop._
import java.net.{URLClassLoader, URLDecoder}
+import scala.collection.mutable
+import scala.xml.NodeSeq
object XMLUtil {
import scala.xml._
@@ -34,21 +36,24 @@ 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(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)
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
def createFactory = {
val settings = new Settings({Console.err.println(_)})
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new DocFactory(reporter, settings)
}
- def createTemplates(basename: String) = {
- val result = scala.collection.mutable.Map[String, scala.xml.NodeSeq]()
+ def createTemplates(basename: String): collection.Map[String, NodeSeq] = {
+ val result = mutable.Map[String, NodeSeq]()
createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
case Some(universe) => {
@@ -57,7 +62,7 @@ object Test extends Properties("HtmlFactory") {
result += (page.absoluteLinkTo(page.path) -> page.body)
})
}
- case _ => ;
+ case _ =>
}
result
diff --git a/test/scaladoc/scalacheck/IndexScriptTest.scala b/test/scaladoc/scalacheck/IndexScriptTest.scala
index 37f6947aaa..b8b9f92965 100644
--- a/test/scaladoc/scalacheck/IndexScriptTest.scala
+++ b/test/scaladoc/scalacheck/IndexScriptTest.scala
@@ -8,14 +8,20 @@ import java.net.{URLClassLoader, URLDecoder}
object Test extends Properties("IndexScript") {
def getClasspath = {
- val loader = Thread.currentThread.getContextClassLoader
- val paths = loader.asInstanceOf[URLClassLoader].getURLs
- val morepaths = loader.getParent.asInstanceOf[URLClassLoader].getURLs
- (paths ++ morepaths).map(u => URLDecoder.decode(u.getPath)).mkString(java.io.File.pathSeparator)
+ // these things can be tricky
+ // 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.
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
val docFactory = {
val settings = new doc.Settings({Console.err.println(_)})
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new doc.DocFactory(reporter, settings)
diff --git a/test/scaladoc/scalacheck/IndexTest.scala b/test/scaladoc/scalacheck/IndexTest.scala
index dc4ab126d4..abc0e5da01 100644
--- a/test/scaladoc/scalacheck/IndexTest.scala
+++ b/test/scaladoc/scalacheck/IndexTest.scala
@@ -12,19 +12,19 @@ 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(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)
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
val docFactory = {
val settings = new doc.Settings({Console.err.println(_)})
-
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
- println(settings.classpath.value)
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
-
new doc.DocFactory(reporter, settings)
}