diff options
author | Antoine Gourlay <antoine@gourlay.fr> | 2014-09-03 10:39:22 +0200 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-09-03 10:39:22 +0200 |
commit | d153ceeed133adfefe6c44a56f8ee502c1278e89 (patch) | |
tree | 5ad0b2d6857e63cf0d3a31f797475cf6d5fba241 /test/scaladoc/run/t8113.scala | |
parent | 2f78ddd3d011457b9afb0078f20e3b612f1e087e (diff) | |
download | scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.tar.gz scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.tar.bz2 scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.zip |
SI-8113 allow a newline between a link target and title
Parsing "[[http://foo.bar link title]]" stops at the first whitespace.
This breaks pretty badly in:
[[http://foo.bar
link title]]
It stops after "link", interprets what it parsed as a link to a member,
obviously fails, and then just ouputs "title".
It should at least return a proper error, or, even better, just allow a
newline between the target and title. I went for the latter.
Diffstat (limited to 'test/scaladoc/run/t8113.scala')
-rw-r--r-- | test/scaladoc/run/t8113.scala | 36 |
1 files changed, 36 insertions, 0 deletions
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")} + } +} |