diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-04-25 15:00:09 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-07-15 01:20:32 -0700 |
commit | 543d719dce062e6ea99c21c7320def711af1cf9e (patch) | |
tree | db6230e5667241dc007788563510c3b390368d6c /test/scaladoc | |
parent | 4e564efb04e508ccc0f479cf1a25331501927d88 (diff) | |
download | scala-543d719dce062e6ea99c21c7320def711af1cf9e.tar.gz scala-543d719dce062e6ea99c21c7320def711af1cf9e.tar.bz2 scala-543d719dce062e6ea99c21c7320def711af1cf9e.zip |
Retain javadoc comments in scaladoc
* Hook into java parser to generate doc comments
* Generate empty trees for java implementation bodies
Diffstat (limited to 'test/scaladoc')
-rw-r--r-- | test/scaladoc/resources/SI-4826.java | 20 | ||||
-rw-r--r-- | test/scaladoc/run/SI-4826.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-4826.scala | 30 |
3 files changed, 51 insertions, 0 deletions
diff --git a/test/scaladoc/resources/SI-4826.java b/test/scaladoc/resources/SI-4826.java new file mode 100644 index 0000000000..f735ce6335 --- /dev/null +++ b/test/scaladoc/resources/SI-4826.java @@ -0,0 +1,20 @@ +package test.scaladoc; + +/** + * Testing java comments. The presence of a :marker: + * tag is verified by tests. + */ +public class JavaComments { + + /** + * Compute the answer to the ultimate question of life, the + * universe, and everything. :marker: + * @param factor scaling factor to the answer + * @return the answer to everything (42) scaled by factor + */ + public int answer(int factor) { + return 42 * factor; + } + +} + diff --git a/test/scaladoc/run/SI-4826.check b/test/scaladoc/run/SI-4826.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/SI-4826.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/SI-4826.scala b/test/scaladoc/run/SI-4826.scala new file mode 100644 index 0000000000..50e4468002 --- /dev/null +++ b/test/scaladoc/run/SI-4826.scala @@ -0,0 +1,30 @@ +import scala.tools.nsc.doc.Universe +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile = "SI-4826.java" + + // overridden to pass explicit files to newDocFactory.makeUniverse (rather than code strings) + // since the .java file extension is required + override def model: Option[Universe] = { + val path = resourcePath + "/" + resourceFile + newDocFactory.makeUniverse(Left(List(path))) + } + + // no need for special settings + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + import access._ + val Tag = ":marker:" + + val base = rootPackage._package("test")._package("scaladoc") + val clazz = base._class("JavaComments") + val method = clazz._method("answer") + + assert(extractCommentText(clazz.comment.get).contains(Tag)) + assert(extractCommentText(method.comment.get).contains(Tag)) + } +} |