From ed52bec270e9ac659638f10c05d1d0efedf4c5cc Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Fri, 15 Apr 2011 16:12:22 +0000 Subject: [scaladoc] Strike-through for deprecated symbol... [scaladoc] Strike-through for deprecated symbols on the reference index. Closes #4471. Review by dubochet. --- test/scaladoc/resources/Trac4471.scala | 9 ++++++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 32 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/scaladoc/resources/Trac4471.scala (limited to 'test/scaladoc') diff --git a/test/scaladoc/resources/Trac4471.scala b/test/scaladoc/resources/Trac4471.scala new file mode 100644 index 0000000000..2a22887c0d --- /dev/null +++ b/test/scaladoc/resources/Trac4471.scala @@ -0,0 +1,9 @@ +class A { + @deprecated def foo = 123 + @deprecated def bar = 456 +} + +class B { + def foo = 123 + @deprecated def bar = 456 +} diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index 15f5249c90..cb31df3fb2 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -24,6 +24,7 @@ object Test extends Properties("HtmlFactory") { 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 @@ -59,6 +60,23 @@ object Test extends Properties("HtmlFactory") { result } + def createReferenceIndex(basename: String) = { + createFactory.makeUniverse(List("test/scaladoc/resources/"+basename)) match { + case Some(universe) => { + val index = IndexModelFactory.makeIndex(universe) + val pages = index.firstLetterIndex.map({ + case (key, value) => { + val page = new ReferenceIndex(key, index, universe) + page.absoluteLinkTo(page.path) -> page.body + } + }) + Some(pages) + } + case _ => + None + } + } + def createTemplate(scala: String) = { val html = scala.stripSuffix(".scala") + ".html" createTemplates(scala)(html) @@ -274,4 +292,18 @@ object Test extends Properties("HtmlFactory") { case _ => false } } + + property("Trac #4471") = { + createReferenceIndex("Trac4471.scala") match { + case Some(pages) => + (pages.get("index/index-f.html") match { + case Some(node) => node.toString.contains(">A") + case _ => false + }) && (pages.get("index/index-b.html") match { + case Some(node) => node.toString.contains(">bar") + case _ => false + }) + case _ => false + } + } } -- cgit v1.2.3