From c402bdde2ecdbc1f63e90a603263e722ffee7202 Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Fri, 25 Mar 2011 22:55:19 +0000 Subject: [scaladoc] Stop wiki syntax parsing inside HTML. --- test/scaladoc/resources/Trac4358.scala | 8 ++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 20 ++++++++++ test/scaladoc/scala/model/CommentFactoryTest.scala | 43 ++++++++++++++++++---- 3 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 test/scaladoc/resources/Trac4358.scala (limited to 'test/scaladoc') diff --git a/test/scaladoc/resources/Trac4358.scala b/test/scaladoc/resources/Trac4358.scala new file mode 100644 index 0000000000..39eee3d47e --- /dev/null +++ b/test/scaladoc/resources/Trac4358.scala @@ -0,0 +1,8 @@ +trait EasyMockSugar { + /** + * Implicit conversion that invokes the expect method on the EasyMock companion object (i.e., the + * static expect method in Java class org.easymock.EasyMock). + * + */ + val foo = 123 +} diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index ecdbb3cf46..da77aed7da 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -124,4 +124,24 @@ object Test extends Properties("HtmlFactory") { case _ => false } } + + property("Trac #4358") = { + val files = createTemplates("Trac4358.scala") + files("EasyMockSugar.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 { _.toString.contains("i.") } + } + case _ => false + } + } } diff --git a/test/scaladoc/scala/model/CommentFactoryTest.scala b/test/scaladoc/scala/model/CommentFactoryTest.scala index 25a91b1fa2..9f60d2a1b7 100644 --- a/test/scaladoc/scala/model/CommentFactoryTest.scala +++ b/test/scaladoc/scala/model/CommentFactoryTest.scala @@ -92,11 +92,9 @@ object Test extends Properties("CommentFactory") { * */""", Chain(List(Text(""), Text("\n"), - HtmlTag("
"), Text("\n"),
-                 Text("hello "), Chain(List(Text("^"),
-                                            Chain(List(Text("world"),
-                                                       Text("\n"),
-                                                       HtmlTag("
"))))))) + + + HtmlTag("
\nhello ^world\n
"))) ) property("Trac #4366 - body") = { @@ -109,8 +107,7 @@ object Test extends Properties("CommentFactory") { ) body == Body(List(Paragraph(Chain(List( - Summary(Chain(List(Chain(List(HtmlTag(""), HtmlTag("foo"), Text(" has been deprecated and will be removed in a future version"))), Text(".")))), - Chain(List(Text(" Please call "), HtmlTag("bar"), Text(" instead."), HtmlTag(""), Text("\n"), Text(""))) + Summary(Chain(List(HtmlTag("foo has been deprecated and will be removed in a future version. Please call bar instead."), Text("\n"), Text("")))) ))))) } @@ -122,7 +119,37 @@ object Test extends Properties("CommentFactory") { */ """ ) + body.summary == Some(Chain(List(HtmlTag("foo has been deprecated and will be removed in a future version. Please call bar instead."), Text("\n"), Text("")))) + } - body.summary == Some(Chain(List(Chain(List(HtmlTag(""), HtmlTag("foo"), Text(" has been deprecated and will be removed in a future version"))), Text(".")))) + property("Trac #4358 - body") = { + factory.createBody( + """ + /** + * Implicit conversion that invokes the expect method on the EasyMock companion object (i.e., the + * static expect method in Java class org.easymock.EasyMock). + */ + """ + ) match { + case Body(List(Paragraph(Chain(List(Summary(Chain(List(Chain(List( + Text("Implicit conversion that invokes the "), + HtmlTag("expect"), + Text(" method on the "), + HtmlTag("EasyMock"), + Text(" companion object ("), + HtmlTag("i.e."), + Text(", the\nstatic "), + HtmlTag("expect"), + Text(" method in Java class "), + HtmlTag("org.easymock.EasyMock"), + Text(")") + )), Text(".")))), Text("\n")))))) => + true + case other => { + println(other) + false + } + } } + } -- cgit v1.2.3