summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-04-21 10:14:38 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2015-04-21 10:14:38 +0200
commitefc1f198b47d1c853b8d5600dfbfb7378a38fe51 (patch)
tree239d3f08621fd43e365fb7b4164535818a63a48e /test/scaladoc
parent56d79460dc3e9dbec054c1459122f5b87989f4e3 (diff)
parentfedbfd74f2d874ef3851f6ce2261011877ac505d (diff)
downloadscala-efc1f198b47d1c853b8d5600dfbfb7378a38fe51.tar.gz
scala-efc1f198b47d1c853b8d5600dfbfb7378a38fe51.tar.bz2
scala-efc1f198b47d1c853b8d5600dfbfb7378a38fe51.zip
Merge commit 'fedbfd7' into merge/2.11-to-2.12-apr-21
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/run/t5795.check4
-rw-r--r--test/scaladoc/run/t5795.scala63
-rw-r--r--test/scaladoc/scalacheck/CommentFactoryTest.scala20
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala4
4 files changed, 88 insertions, 3 deletions
diff --git a/test/scaladoc/run/t5795.check b/test/scaladoc/run/t5795.check
new file mode 100644
index 0000000000..d08ab619ed
--- /dev/null
+++ b/test/scaladoc/run/t5795.check
@@ -0,0 +1,4 @@
+newSource:16: warning: Could not find any member to link for "Exception".
+ /**
+ ^
+Done.
diff --git a/test/scaladoc/run/t5795.scala b/test/scaladoc/run/t5795.scala
new file mode 100644
index 0000000000..767e4f1a72
--- /dev/null
+++ b/test/scaladoc/run/t5795.scala
@@ -0,0 +1,63 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+/**
+ * Only the 'deprecated' tag should stay.
+ *
+ * @author
+ * @since
+ * @todo
+ * @note
+ * @see
+ * @version
+ * @deprecated
+ * @example
+ * @constructor
+ */
+object Test {
+ /**
+ * Only the 'throws' tag should stay.
+ * @param foo
+ * @param bar
+ * @param baz
+ * @return
+ * @throws Exception
+ * @tparam T
+ */
+ def foo[T](foo: Any, bar: Any, baz: Any): Int = 1
+}
+ """
+
+ def scaladocSettings = ""
+
+ def test(b: Boolean, text: => String): Unit = if (!b) println(text)
+
+ def testModel(root: Package) = {
+ import access._
+ val obj = root._object("Test")
+ val c = obj.comment.get
+
+ test(c.authors.isEmpty, s"expected no authors, found: ${c.authors}")
+ test(!c.since.isDefined, s"expected no since tag, found: ${c.since}")
+ test(c.todo.isEmpty, s"expected no todos, found: ${c.todo}")
+ test(c.note.isEmpty, s"expected no note, found: ${c.note}")
+ test(c.see.isEmpty, s"expected no see, found: ${c.see}")
+ test(!c.version.isDefined, s"expected no version tag, found: ${c.version}")
+ // deprecated stays
+ test(c.deprecated.isDefined, s"expected deprecated tag, found none")
+ test(c.example.isEmpty, s"expected no example, found: ${c.example}")
+ test(!c.constructor.isDefined, s"expected no constructor tag, found: ${c.constructor}")
+
+ val method = obj._method("foo")
+ val mc = method.comment.get
+
+ test(mc.valueParams.isEmpty, s"expected empty value params, found: ${mc.valueParams}")
+ test(mc.typeParams.isEmpty, s"expected empty type params, found: ${mc.typeParams}")
+ test(!mc.result.isDefined, s"expected no result tag, found: ${mc.result}")
+ // throws stay
+ test(!mc.throws.isEmpty, s"expected an exception tag, found: ${mc.throws}")
+ }
+}
diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala
index ff64a25602..d30b78087c 100644
--- a/test/scaladoc/scalacheck/CommentFactoryTest.scala
+++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala
@@ -24,8 +24,11 @@ class Factory(val g: Global, val s: doc.Settings)
}
}
+ def getComment(s: String): Comment =
+ parse(s, "", scala.tools.nsc.util.NoPosition, null)
+
def parseComment(s: String): Option[Inline] =
- strip(parse(s, "", scala.tools.nsc.util.NoPosition, null))
+ strip(getComment(s))
def createBody(s: String) =
parse(s, "", scala.tools.nsc.util.NoPosition, null).body
@@ -166,4 +169,19 @@ object Test extends Properties("CommentFactory") {
}
}
+ property("Empty parameter text should be empty") = {
+ // used to fail with
+ // body == Body(List(Paragraph(Chain(List(Summary(Text('\n')))))))
+ factory.getComment(
+ """
+/**
+ * @deprecated
+ */
+ """).deprecated match {
+ case Some(Body(l)) if l.isEmpty => true
+ case other =>
+ println(other)
+ false
+ }
+ }
}
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 6b59355991..98a601bb20 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -685,7 +685,7 @@ object Test extends Properties("HtmlFactory") {
case node: scala.xml.Node => {
val s = node.toString
s.contains("<h6>Author:</h6>") &&
- s.contains("<p>The Only Author\n</p>")
+ s.contains("<p>The Only Author</p>")
}
case _ => false
}
@@ -699,7 +699,7 @@ object Test extends Properties("HtmlFactory") {
val s = node.toString
s.contains("<h6>Authors:</h6>") &&
s.contains("<p>The First Author</p>") &&
- s.contains("<p>The Second Author\n</p>")
+ s.contains("<p>The Second Author</p>")
}
case _ => false
}