summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-03-22 14:10:25 +0000
committerKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-03-22 14:10:25 +0000
commitfed7729dbb708ea2e1d138e79e20b9ec9bdbe3fd (patch)
tree12f3750d096bd48a3cb6c2c3f97befd659731edb /test/scaladoc
parent063e8a9dfee3d2c889f9e2e28cda2e8a28aa61cc (diff)
downloadscala-fed7729dbb708ea2e1d138e79e20b9ec9bdbe3fd.tar.gz
scala-fed7729dbb708ea2e1d138e79e20b9ec9bdbe3fd.tar.bz2
scala-fed7729dbb708ea2e1d138e79e20b9ec9bdbe3fd.zip
[scaladoc] Closes #4366. Review by pedrofurla.
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/resources/Trac4366.scala8
-rw-r--r--test/scaladoc/scala/html/HtmlFactoryTest.scala26
-rw-r--r--test/scaladoc/scala/model/CommentFactoryTest.scala30
3 files changed, 64 insertions, 0 deletions
diff --git a/test/scaladoc/resources/Trac4366.scala b/test/scaladoc/resources/Trac4366.scala
new file mode 100644
index 0000000000..d117ffa903
--- /dev/null
+++ b/test/scaladoc/resources/Trac4366.scala
@@ -0,0 +1,8 @@
+class Trac4366 {
+ /**
+ * <strong><code>foo</code> has been deprecated and will be removed in a future version of
+ * ScalaTest. Please call <code>bar</code> instead.</strong>
+ */
+ @deprecated // deprecated in 1.0, remove in 1.4
+ val foo: Option[String] = None
+}
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala
index f0f1cd7e49..ecdbb3cf46 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.scala
+++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala
@@ -98,4 +98,30 @@ object Test extends Properties("HtmlFactory") {
val files = createTemplates("Trac4306.scala")
files("com/example/trac4306/foo/package$$Bar.html") != None
}
+
+ property("Trac #4366") = {
+ val files = createTemplates("Trac4366.scala")
+ files("Trac4366.html") match {
+ case node: scala.xml.Node => {
+ val comments = XMLUtil.stripGroup(node).descendant.flatMap {
+ case e: scala.xml.Elem => {
+ if (e.attribute("class").toString.contains("shortcomment")) {
+ Some(e)
+ } else {
+ None
+ }
+ }
+ case _ => None
+ }
+
+ comments.exists {
+ (e) => {
+ val s = e.toString
+ s.contains("<code>foo</code>") && s.contains("</strong>")
+ }
+ }
+ }
+ case _ => false
+ }
+ }
}
diff --git a/test/scaladoc/scala/model/CommentFactoryTest.scala b/test/scaladoc/scala/model/CommentFactoryTest.scala
index afe27dace0..25a91b1fa2 100644
--- a/test/scaladoc/scala/model/CommentFactoryTest.scala
+++ b/test/scaladoc/scala/model/CommentFactoryTest.scala
@@ -18,6 +18,9 @@ class Factory(val g: Global, val s: doc.Settings)
def parseComment(s: String): Option[Inline] =
strip(parse(s, "", scala.tools.nsc.util.NoPosition))
+
+ def createBody(s: String) =
+ parse(s, "", scala.tools.nsc.util.NoPosition).body
}
object Test extends Properties("CommentFactory") {
@@ -95,4 +98,31 @@ object Test extends Properties("CommentFactory") {
Text("\n"),
HtmlTag("</pre>")))))))
)
+
+ property("Trac #4366 - body") = {
+ val body = factory.createBody(
+ """
+ /**
+ * <strong><code>foo</code> has been deprecated and will be removed in a future version. Please call <code>bar</code> instead.</strong>
+ */
+ """
+ )
+
+ body == Body(List(Paragraph(Chain(List(
+ Summary(Chain(List(Chain(List(HtmlTag("<strong>"), HtmlTag("<code>foo</code>"), Text(" has been deprecated and will be removed in a future version"))), Text(".")))),
+ Chain(List(Text(" Please call "), HtmlTag("<code>bar</code>"), Text(" instead."), HtmlTag("</strong>"), Text("\n"), Text("")))
+ )))))
+ }
+
+ property("Trac #4366 - summary") = {
+ val body = factory.createBody(
+ """
+ /**
+ * <strong><code>foo</code> has been deprecated and will be removed in a future version. Please call <code>bar</code> instead.</strong>
+ */
+ """
+ )
+
+ body.summary == Some(Chain(List(Chain(List(HtmlTag("<strong>"), HtmlTag("<code>foo</code>"), Text(" has been deprecated and will be removed in a future version"))), Text("."))))
+ }
}