summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/.gitignore2
-rw-r--r--test/scaladoc/resources/SI-4826.java20
-rw-r--r--test/scaladoc/run/SI-191.scala12
-rw-r--r--test/scaladoc/run/SI-4826.check1
-rw-r--r--test/scaladoc/run/SI-4826.scala30
-rw-r--r--test/scaladoc/run/t8557.scala20
6 files changed, 78 insertions, 7 deletions
diff --git a/test/scaladoc/.gitignore b/test/scaladoc/.gitignore
new file mode 100644
index 0000000000..161be5b55f
--- /dev/null
+++ b/test/scaladoc/.gitignore
@@ -0,0 +1,2 @@
+*.log
+*.obj/
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-191.scala b/test/scaladoc/run/SI-191.scala
index 29b1e7dd29..f3d269ceb0 100644
--- a/test/scaladoc/run/SI-191.scala
+++ b/test/scaladoc/run/SI-191.scala
@@ -33,10 +33,14 @@ object Test extends ScaladocModelTest {
def scalaURL = "http://bog.us"
override def scaladocSettings = {
- val scalaLibUri = getClass.getClassLoader.getResource("scala/Function1.class").getPath.split("!")(0)
- val scalaLibPath = new URI(scalaLibUri).getPath
- val externalArg = s"$scalaLibPath#$scalaURL"
- "-no-link-warnings -doc-external-doc " + externalArg
+ val samplePath = getClass.getClassLoader.getResource("scala/Function1.class").getPath
+ val scalaLibPath = if(samplePath.contains("!")) { // in scala-library.jar
+ val scalaLibUri = samplePath.split("!")(0)
+ new URI(scalaLibUri).getPath
+ } else { // individual class files on disk
+ samplePath.replace('\\', '/').dropRight("scala/Function1.class".length)
+ }
+ s"-no-link-warnings -doc-external-doc $scalaLibPath#$scalaURL"
}
def testModel(rootPackage: Package) {
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))
+ }
+}
diff --git a/test/scaladoc/run/t8557.scala b/test/scaladoc/run/t8557.scala
index 451f004d7d..7876896bb7 100644
--- a/test/scaladoc/run/t8557.scala
+++ b/test/scaladoc/run/t8557.scala
@@ -1,3 +1,5 @@
+import java.net.URI
+
import scala.tools.nsc.doc.base._
import scala.tools.nsc.doc.model._
import scala.tools.partest.ScaladocModelTest
@@ -15,10 +17,22 @@ object Test extends ScaladocModelTest {
class A
"""
+ def scalaURL = "http://www.scala-lang.org/api/current/"
+
// a non-canonical path to scala-library.jar should still work
- // this is a bit fragile (depends on the current directory being the root of the repo ;
- // ant & partest seem to do that properly)
- def scaladocSettings = "-doc-external-doc build/pack/bin/../lib/scala-library.jar#http://www.scala-lang.org/api/current/"
+ override def scaladocSettings = {
+ val samplePath = getClass.getClassLoader.getResource("scala/Function1.class").getPath.replace('\\', '/')
+ val scalaLibPath = if(samplePath.contains("!")) { // in scala-library.jar
+ val scalaLibUri = samplePath.split("!")(0)
+ val p = new URI(scalaLibUri).getPath
+ // this is a bit fragile (depends on the scala library being in build/pack as produced by ant)
+ p.replace("/pack/lib/scala-library.jar", "/pack/bin/../lib/scala-library.jar")
+ } else { // individual class files on disk
+ val p = samplePath.dropRight("scala/Function1.class".length + 1)
+ p + "/.." + p.takeRight(p.length - p.lastIndexOf('/'))
+ }
+ s"-doc-external-doc $scalaLibPath#$scalaURL"
+ }
def testModel(rootPackage: Package) = {
// get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))