summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-03-14 08:44:12 +0100
committerFelix Mulder <felix.mulder@gmail.com>2016-03-14 10:45:31 +0100
commitc70292627c50adbbd5c4118a01a34bd7c23ba6b6 (patch)
tree8ee79961bf88179c340b3f18fdd374cea2887903 /test/scaladoc
parentac8c6e8f3a8f33d5987fc1fa320b3def5373a504 (diff)
downloadscala-c70292627c50adbbd5c4118a01a34bd7c23ba6b6.tar.gz
scala-c70292627c50adbbd5c4118a01a34bd7c23ba6b6.tar.bz2
scala-c70292627c50adbbd5c4118a01a34bd7c23ba6b6.zip
Remove unused classes from Scaladoc
Several elements of the old Scaladoc are not in use anymore. To help with any reverting, the removal of these is done in a single commit (this one). The removal includes: - Old `Index`, the old top "index.html" - The letter index (with "_" and "deprecated") - The old `Template` which is superceded by `Entity`
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/run/SI-6580.scala1
-rw-r--r--test/scaladoc/scalacheck/DeprecatedIndexTest.scala52
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala45
-rw-r--r--test/scaladoc/scalacheck/IndexScriptTest.scala9
-rw-r--r--test/scaladoc/scalacheck/IndexTest.scala89
5 files changed, 4 insertions, 192 deletions
diff --git a/test/scaladoc/run/SI-6580.scala b/test/scaladoc/run/SI-6580.scala
index c544138f44..55168a060b 100644
--- a/test/scaladoc/run/SI-6580.scala
+++ b/test/scaladoc/run/SI-6580.scala
@@ -1,6 +1,5 @@
import scala.tools.nsc.doc
import scala.tools.nsc.doc.model._
-import scala.tools.nsc.doc.html.page.{Index, ReferenceIndex}
import scala.tools.partest.ScaladocModelTest
object Test extends ScaladocModelTest {
diff --git a/test/scaladoc/scalacheck/DeprecatedIndexTest.scala b/test/scaladoc/scalacheck/DeprecatedIndexTest.scala
deleted file mode 100644
index 2581b879da..0000000000
--- a/test/scaladoc/scalacheck/DeprecatedIndexTest.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-import org.scalacheck._
-import org.scalacheck.Prop._
-
-import scala.tools.nsc.ScalaDocReporter
-import scala.tools.nsc.doc
-import scala.tools.nsc.doc.html.page.DeprecatedIndex
-import java.net.{URLClassLoader, URLDecoder}
-
-object Test extends Properties("IndexScript") {
-
- def getClasspath = {
- // 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)
- }
-
- val indexModelFactory = doc.model.IndexModelFactory
-
- def createDeprecatedScript(path: String) =
- docFactory.makeUniverse(Left(List(path))) match {
- case Some(universe) => {
- val reporter = new ScalaDocReporter(universe.settings)
- val index = new DeprecatedIndex(universe, indexModelFactory.makeIndex(universe), reporter)
- Some(index)
- }
- case _ =>
- None
- }
-
- property("deprecated-list page lists deprecated members") = {
- createDeprecatedScript("test/scaladoc/resources/SI-4476.scala") match {
- case Some(p) =>
- p.deprecatedEntries.find(_._1 == "A").isDefined &&
- p.deprecatedEntries.find(_._1 == "bar").isDefined
- case None => false
- }
- }
-}
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index a7da1e29a7..ab2c058a03 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -26,12 +26,9 @@ object Test extends Properties("HtmlFactory") {
final val RESOURCES = "test/scaladoc/resources/"
-
import scala.tools.nsc.ScalaDocReporter
import scala.tools.nsc.doc.{DocFactory, Settings}
- import scala.tools.nsc.doc.model.IndexModelFactory
import scala.tools.nsc.doc.html.HtmlFactory
- import scala.tools.nsc.doc.html.page.ReferenceIndex
def getClasspath = {
// these things can be tricky
@@ -60,8 +57,7 @@ object Test extends Properties("HtmlFactory") {
createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
case Some(universe) => {
- val index = IndexModelFactory.makeIndex(universe)
- (new HtmlFactory(universe, index, new ScalaDocReporter(universe.settings))).writeTemplates((page) => {
+ new HtmlFactory(universe, new ScalaDocReporter(universe.settings)).writeTemplates((page) => {
result += (page.absoluteLinkTo(page.path) -> page.body)
})
}
@@ -71,24 +67,6 @@ object Test extends Properties("HtmlFactory") {
result
}
- def createReferenceIndex(basename: String) = {
- createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
- case Some(universe) => {
- val index = IndexModelFactory.makeIndex(universe)
- val pages = index.firstLetterIndex.map({
- case (key, value) => {
- val reporter = new ScalaDocReporter(universe.settings)
- val page = new ReferenceIndex(key, index, universe, reporter)
- page.absoluteLinkTo(page.path) -> page.body
- }
- })
- Some(pages)
- }
- case _ =>
- None
- }
- }
-
def createTemplate(scala: String) = {
val html = scala.stripSuffix(".scala") + ".html"
createTemplates(scala)(html)
@@ -339,27 +317,6 @@ object Test extends Properties("HtmlFactory") {
}
}
- property("Trac #4471") = {
- createReferenceIndex("Trac4471.scala") match {
- case Some(pages) =>
- (pages.get("index/index-f.html") match {
- case Some(node) => node.toString.contains(">A</a></strike>")
- case _ => false
- }) && (pages.get("index/index-b.html") match {
- case Some(node) => node.toString.contains(">bar</strike>")
- case _ => false
- })
- case _ => false
- }
- }
-
- property("SI-4641") = {
- createReferenceIndex("SI_4641.scala") match {
- case Some(pages) => pages.contains("index/index-_.html")
- case _ => false
- }
- }
-
property("SI-4421") = {
createTemplate("SI_4421.scala") match {
case node: scala.xml.Node => {
diff --git a/test/scaladoc/scalacheck/IndexScriptTest.scala b/test/scaladoc/scalacheck/IndexScriptTest.scala
index b8b9f92965..61f462186d 100644
--- a/test/scaladoc/scalacheck/IndexScriptTest.scala
+++ b/test/scaladoc/scalacheck/IndexScriptTest.scala
@@ -31,17 +31,14 @@ object Test extends Properties("IndexScript") {
def createIndexScript(path: String) =
docFactory.makeUniverse(Left(List(path))) match {
- case Some(universe) => {
- val index = new IndexScript(universe,
- indexModelFactory.makeIndex(universe))
- Some(index)
- }
+ case Some(universe) =>
+ Some(new IndexScript(universe))
case _ =>
None
}
property("allPackages") = {
- createIndexScript("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
+ createIndexScript("src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala") match {
case Some(index) =>
index.allPackages.map(_.toString) == List(
"scala",
diff --git a/test/scaladoc/scalacheck/IndexTest.scala b/test/scaladoc/scalacheck/IndexTest.scala
deleted file mode 100644
index 036586c21d..0000000000
--- a/test/scaladoc/scalacheck/IndexTest.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-import org.scalacheck._
-import org.scalacheck.Prop._
-
-import scala.tools.nsc.ScalaDocReporter
-import scala.tools.nsc.doc
-import scala.tools.nsc.doc.html.page.Index
-import java.net.{URLClassLoader, URLDecoder}
-
-object Test extends Properties("Index") {
-
- def getClasspath = {
- // 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)
- }
-
- val indexModelFactory = doc.model.IndexModelFactory
-
- def createIndex(path: String): Option[Index] = {
-
- val maybeUniverse = {
- //val stream = new java.io.ByteArrayOutputStream
- //val original = Console.out
- //Console.setOut(stream)
-
- val result = docFactory.makeUniverse(Left(List(path)))
-
- // assert(stream.toString == "model contains 2 documentable templates\n")
- //Console.setOut(original)
-
- result
- }
-
- maybeUniverse match {
- case Some(universe) => {
- val reporter = new ScalaDocReporter(universe.settings)
- val index = new Index(universe, indexModelFactory.makeIndex(universe), reporter)
- return Some(index)
- }
- case _ => return None
- }
-
- }
-
- property("path") = {
- createIndex("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
- case Some(index) =>
- index.path == List("index.html")
- case None => false
- }
- }
-
- property("title") = {
- createIndex("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
- case Some(index) =>
- index.title == ""
-
- case None => false
- }
- }
- property("package objects in index") = {
- createIndex("test/scaladoc/resources/SI-5558.scala") match {
- case Some(index) =>
- index.index.firstLetterIndex('f') isDefinedAt "foo"
- case None => false
- }
- }
- property("index should report if there are deprecated members") = {
- createIndex("test/scaladoc/resources/SI-4476.scala") match {
- case Some(indexPage) => indexPage.index.hasDeprecatedMembers
- case None => false
- }
- }
-}