diff options
Diffstat (limited to 'test/scaladoc')
-rw-r--r-- | test/scaladoc/run/t8113.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/t8113.scala | 36 | ||||
-rw-r--r-- | test/scaladoc/run/t8314.check | 3 | ||||
-rw-r--r-- | test/scaladoc/run/t8314.scala | 16 | ||||
-rw-r--r-- | test/scaladoc/run/t8557.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/t8557.scala | 32 |
6 files changed, 89 insertions, 0 deletions
diff --git a/test/scaladoc/run/t8113.check b/test/scaladoc/run/t8113.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/t8113.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/t8113.scala b/test/scaladoc/run/t8113.scala new file mode 100644 index 0000000000..f006213ef2 --- /dev/null +++ b/test/scaladoc/run/t8113.scala @@ -0,0 +1,36 @@ +import scala.tools.nsc.doc.base._ +import scala.tools.nsc.doc.base.comment._ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def code = """ + /** + * Check out [[http://www.scala-lang.org + * this great website]]! + */ + class Test + """ + + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + import access._ + + val test = rootPackage._class("Test") + + // find Link + def find(body: Any): Option[Link] = body match { + case l: Link => Some(l) + case s: Seq[_] => s.toList.map(find(_)).flatten.headOption + case p: Product => p.productIterator.toList.map(find(_)).flatten.headOption + case _ => None + } + + val link = find(test.comment.get.body).collect { case Link(ta, Text(ti)) => (ta, ti) } + assert(link.isDefined) + val expected = ("http://www.scala-lang.org", "this great website") + link.foreach {l => assert(l == expected, s"$l != $expected")} + } +} diff --git a/test/scaladoc/run/t8314.check b/test/scaladoc/run/t8314.check new file mode 100644 index 0000000000..aa04c12c8f --- /dev/null +++ b/test/scaladoc/run/t8314.check @@ -0,0 +1,3 @@ +Body(List(Paragraph(Chain(List(Summary(Chain(List(Text(This should be ), Monospace(Text(monospaced)))))))))) + +Done. diff --git a/test/scaladoc/run/t8314.scala b/test/scaladoc/run/t8314.scala new file mode 100644 index 0000000000..7f6d6fdb00 --- /dev/null +++ b/test/scaladoc/run/t8314.scala @@ -0,0 +1,16 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + /** This should be `monospaced` */ + class A + """ + + def scaladocSettings = "" + + def testModel(root: Package) = { + import access._ + root._class("A").comment foreach println + } +} diff --git a/test/scaladoc/run/t8557.check b/test/scaladoc/run/t8557.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/t8557.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/t8557.scala b/test/scaladoc/run/t8557.scala new file mode 100644 index 0000000000..451f004d7d --- /dev/null +++ b/test/scaladoc/run/t8557.scala @@ -0,0 +1,32 @@ +import scala.tools.nsc.doc.base._ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def code = """ + package scala.test.scaladoc.T8857 + + /** + * A link: + * + * [[scala.Option$ object Option]]. + */ + class A + """ + + // a non-canonical path to scala-library.jar should still work + // this is a bit fragile (depends on the current directory being the root of the repo ; + // ant & partest seem to do that properly) + def scaladocSettings = "-doc-external-doc build/pack/bin/../lib/scala-library.jar#http://www.scala-lang.org/api/current/" + + def testModel(rootPackage: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + val a = rootPackage._package("scala")._package("test")._package("scaladoc")._package("T8857")._class("A") + + val links = countLinks(a.comment.get, _.link.isInstanceOf[LinkToExternal]) + assert(links == 1, links + " == 1 (the links to external in class A)") + } +} |