summaryrefslogtreecommitdiff
path: root/test/scaladoc/run
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-07-12 00:31:25 +0200
committerVlad Ureche <vlad.ureche@gmail.com>2012-07-16 23:41:44 +0200
commitdc70d1b7bd193ff42e9bed5d80f632cffb85a667 (patch)
treeed8cd8eff307a6d817e2c65829f06b2cb66d8080 /test/scaladoc/run
parent929415a3f4d5d6261d10cc6d28720c5241716bae (diff)
downloadscala-dc70d1b7bd193ff42e9bed5d80f632cffb85a667.tar.gz
scala-dc70d1b7bd193ff42e9bed5d80f632cffb85a667.tar.bz2
scala-dc70d1b7bd193ff42e9bed5d80f632cffb85a667.zip
SI-3695 SI-4224 SI-4497 SI-5079 scaladoc links
Adds the ability to link to members, classes and objects in scaladoc. The links can now be either qualified names or relative names, they both work. See the test/scaladoc/resources/links.scala for a usage example. Also introduced -no-link-warnings scaladoc flag, in case the build output gets swamped with link warnings.
Diffstat (limited to 'test/scaladoc/run')
-rw-r--r--test/scaladoc/run/SI-5235.scala4
-rw-r--r--test/scaladoc/run/links.check1
-rw-r--r--test/scaladoc/run/links.scala28
3 files changed, 31 insertions, 2 deletions
diff --git a/test/scaladoc/run/SI-5235.scala b/test/scaladoc/run/SI-5235.scala
index f0c6e1cf17..6295fc7786 100644
--- a/test/scaladoc/run/SI-5235.scala
+++ b/test/scaladoc/run/SI-5235.scala
@@ -79,8 +79,8 @@ object Test extends ScaladocModelTest {
assert(mcReverseType.name == "MyCollection",mcReverseType.name + " == MyCollection")
assert(gcReverseType.refEntity(0)._1 == LinkToTpl(GenericColl),
gcReverse.qualifiedName + "'s return type has a link to " + GenericColl.qualifiedName)
- assert(!scReverseType.refEntity(0)._1.asInstanceOf[LinkToTpl].tpl.isDocTemplate,
- scReverse.qualifiedName + "'s return type does not have links")
+ assert(scReverseType.refEntity(0)._1 == Tooltip("BullSh"),
+ scReverseType.refEntity(0)._1 + " == Tooltip(\"BullSh\")")
assert(mcReverseType.refEntity(0)._1 == LinkToTpl(MyCollection),
mcReverse.qualifiedName + "'s return type has a link to " + MyCollection.qualifiedName)
}
diff --git a/test/scaladoc/run/links.check b/test/scaladoc/run/links.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/links.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala
new file mode 100644
index 0000000000..40ce6368ce
--- /dev/null
+++ b/test/scaladoc/run/links.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+// SI-5079 "Scaladoc can't link to an object (only a class or trait)"
+// SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient"
+// SI-4224 "Wiki-links should support method targets"
+// SI-3695 "support non-fully-qualified type links in scaladoc comments"
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "links.scala"
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ 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._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("links")
+ val TEST = base._object("TEST")
+
+ val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember])
+ val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl])
+ assert(memberLinks == 14, memberLinks + " == 14 (the member links in object TEST)")
+ assert(templateLinks == 2, templateLinks + " == 2 (the template links in object TEST)")
+ }
+} \ No newline at end of file