summaryrefslogtreecommitdiff
path: root/test/scaladoc/resources
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-03-16 01:25:36 +0100
committerVlad Ureche <vlad.ureche@gmail.com>2012-03-16 01:25:36 +0100
commitdca8725cbb04e38f86095fe7fb561fa78cdde9b2 (patch)
tree2da2b213cb448ab7068e9347f04ce12405530ab6 /test/scaladoc/resources
parentee51b6e1b1bc4bd60e6f6bbaea6eb3d4be8b3c97 (diff)
downloadscala-dca8725cbb04e38f86095fe7fb561fa78cdde9b2.tar.gz
scala-dca8725cbb04e38f86095fe7fb561fa78cdde9b2.tar.bz2
scala-dca8725cbb04e38f86095fe7fb561fa78cdde9b2.zip
Merged and cleaned the 'feature/inheritdoc' branch
Diffstat (limited to 'test/scaladoc/resources')
-rw-r--r--test/scaladoc/resources/explicit-inheritance-override.scala48
-rw-r--r--test/scaladoc/resources/explicit-inheritance-usecase.scala47
-rw-r--r--test/scaladoc/resources/implicit-inheritance-override.scala8
-rw-r--r--test/scaladoc/resources/inheritdoc-corner-cases.scala78
4 files changed, 177 insertions, 4 deletions
diff --git a/test/scaladoc/resources/explicit-inheritance-override.scala b/test/scaladoc/resources/explicit-inheritance-override.scala
new file mode 100644
index 0000000000..62ce653aea
--- /dev/null
+++ b/test/scaladoc/resources/explicit-inheritance-override.scala
@@ -0,0 +1,48 @@
+// This tests the implicit comment inheritance capabilities of scaladoc for class inheritance (no $super, no @inheritdoc)
+class InheritDocBase {
+ /**
+ * The base comment. And another sentence...
+ *
+ * @param arg1 The T term comment
+ * @param arg2 The string comment
+ * @tparam T the type of the first argument
+ * @throws SomeException if the function is not called with correct parameters
+ * @return The return comment
+ * @see The Manual
+ * @note Be careful!
+ * @example function[Int](3, "something")
+ * @author a Scala developer
+ * @version 0.0.2
+ * @since 0.0.1
+ * @todo Call mom.
+ */
+ def function[T](arg1: T, arg2: String): Double = 0.0d
+}
+
+class InheritDocDerived extends InheritDocBase {
+ /**
+ * Starting line
+ *
+ * @inheritdoc
+ * @inheritdoc
+ *
+ * Ending line
+ *
+ * @param arg1 Start1 @inheritdoc End1
+ * @param arg2 Start2 @inheritdoc End2
+ * @param arg3 Start3 ShouldWarn @inheritdoc End3
+ * @tparam T StartT @inheritdoc EndT
+ * @tparam ShouldWarn StartSW @inheritdoc EndSW
+ * @throws SomeException StartEx @inheritdoc EndEx
+ * @throws SomeOtherException StartSOE Should Warn @inheritdoc EndSOE
+ * @return StartRet @inheritdoc EndRet
+ * @see StartSee @inheritdoc EndSee
+ * @note StartNote @inheritdoc EndNote
+ * @example StartExample @inheritdoc EndExample
+ * @author StartAuthor @inheritdoc EndAuthor
+ * @version StartVer @inheritdoc EndVer
+ * @since StartSince @inheritdoc EndSince
+ * @todo StartTodo @inheritdoc And dad! EndTodo
+ */
+ override def function[T](arg1: T, arg2: String): Double = 1.0d
+} \ No newline at end of file
diff --git a/test/scaladoc/resources/explicit-inheritance-usecase.scala b/test/scaladoc/resources/explicit-inheritance-usecase.scala
new file mode 100644
index 0000000000..e10cec437a
--- /dev/null
+++ b/test/scaladoc/resources/explicit-inheritance-usecase.scala
@@ -0,0 +1,47 @@
+// This tests the implicit comment inheritance capabilities of scaladoc for usecases (no $super, no @inheritdoc)
+/** Testing use case inheritance */
+class UseCaseInheritDoc {
+ /**
+ * The base comment. And another sentence...
+ *
+ * @param arg1 The T term comment
+ * @param arg2 The string comment
+ * @tparam T the type of the first argument
+ * @throws SomeException if the function is not called with correct parameters
+ * @return The return comment
+ * @see The Manual
+ * @note Be careful!
+ * @example function[Int](3, "something")
+ * @author a Scala developer
+ * @version 0.0.2
+ * @since 0.0.1
+ * @todo Call mom.
+ *
+ * @usecase def function[T](arg1: T, arg2: String): Double
+ *
+ * Starting line
+ *
+ * @inheritdoc
+ * @inheritdoc
+ *
+ * Ending line
+ *
+ * @param arg1 Start1 @inheritdoc End1
+ * @param arg2 Start2 @inheritdoc End2
+ * @param arg3 Start3 ShouldWarn @inheritdoc End3
+ * @tparam T StartT @inheritdoc EndT
+ * @tparam ShouldWarn StartSW @inheritdoc EndSW
+ * @throws SomeException StartEx @inheritdoc EndEx
+ * @throws SomeOtherException StartSOE Should Warn @inheritdoc EndSOE
+ * @return StartRet @inheritdoc EndRet
+ * @see StartSee @inheritdoc EndSee
+ * @note StartNote @inheritdoc EndNote
+ * @example StartExample @inheritdoc EndExample
+ * @author StartAuthor @inheritdoc EndAuthor
+ * @version StartVer @inheritdoc EndVer
+ * @since StartSince @inheritdoc EndSince
+ * @todo StartTodo @inheritdoc And dad! EndTodo
+ */
+ def function[T](implicit arg1: T, arg2: String): Double = 0.0d
+}
+
diff --git a/test/scaladoc/resources/implicit-inheritance-override.scala b/test/scaladoc/resources/implicit-inheritance-override.scala
index 85b8e8d543..5d692f59ad 100644
--- a/test/scaladoc/resources/implicit-inheritance-override.scala
+++ b/test/scaladoc/resources/implicit-inheritance-override.scala
@@ -2,12 +2,12 @@
class Base {
/**
* The base comment. And another sentence...
- *
- * @param arg1 The T term comment
- * @param arg2 The string comment
+ *
+ * @param arg1 The T term comment
+ * @param arg2 The string comment
* @tparam T the type of the first argument
* @return The return comment
- */
+ */
def function[T](arg1: T, arg2: String): Double = 0.0d
}
diff --git a/test/scaladoc/resources/inheritdoc-corner-cases.scala b/test/scaladoc/resources/inheritdoc-corner-cases.scala
new file mode 100644
index 0000000000..8cd995e605
--- /dev/null
+++ b/test/scaladoc/resources/inheritdoc-corner-cases.scala
@@ -0,0 +1,78 @@
+// TEST1: Inherit from multiple classes
+trait A {
+ /**
+ * Hello 1 comment
+ */
+ def hello1 = 0
+}
+
+trait B {
+ /**
+ * Hello 2 comment
+ */
+ def hello2 = 1
+}
+
+trait C extends B
+
+class D extends A with C {
+ /**
+ * Inherited: @inheritdoc
+ */
+ override def hello1 = super.hello2
+
+ /**
+ * Inherited: @inheritdoc
+ */
+ override def hello2 = super.hello1
+}
+
+// TEST2: Invalid inherit: no parents
+trait E {
+ /**
+ * @inheritdoc
+ */
+ def whereDidThisComeFrom
+}
+
+// TEST3: Invalid inherit, but other parents present
+trait F extends E {
+ /**
+ * @inheritdoc
+ */
+ def howAboutThis
+}
+
+
+// TEST4: Inherit from something that inherits: inherit should propagate
+trait G extends D {
+ /**
+ * @inheritdoc
+ */
+ override def hello1 = 13
+
+ /**
+ * @inheritdoc
+ */
+ override def hello2 = 14
+}
+
+// TEST5: Inherit missing parameters
+trait H extends G {
+ /**
+ * Missing params
+ * @throws HelloException @inheritdoc
+ * @todo @inheritdoc
+ */
+ override def hello1 = 15
+}
+
+// TEST6: Inherit from something that inherits in the usecase
+trait I extends G {
+ /**
+ * @inheritdoc
+ * @usecase def hello1(i: Int)
+ * @inheritdoc
+ */
+ override def hello1 = 13
+} \ No newline at end of file