aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src/test
diff options
context:
space:
mode:
authoririna-turova <31963497+irina-turova@users.noreply.github.com>2023-05-31 16:16:10 +0500
committerGitHub <noreply@github.com>2023-05-31 13:16:10 +0200
commitf45750699d089e0101dcde5d38c7e08ec2f03708 (patch)
tree13a59ca4458374731e92766f70a1f2183a4ba368 /plugins/javadoc/src/test
parent0cad056d84bf1dbe285ca008be17ca5fbb224818 (diff)
downloaddokka-f45750699d089e0101dcde5d38c7e08ec2f03708.tar.gz
dokka-f45750699d089e0101dcde5d38c7e08ec2f03708.tar.bz2
dokka-f45750699d089e0101dcde5d38c7e08ec2f03708.zip
Add support for `@author`, `@since`, `@return` Javadoc tags (#2967)
Diffstat (limited to 'plugins/javadoc/src/test')
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt98
1 files changed, 98 insertions, 0 deletions
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
index 65fbd30f..53167f71 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
@@ -342,6 +342,104 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest(
}
}
+ @Test
+ fun `@author @since @return method tags`(){
+ dualTestTemplateMapInline(
+ kotlin =
+ """
+ /src/source0.kt
+ package com.test.package0
+ class TestClass {
+ /**
+ * Testing @author @since @return method tags
+ * @since 1.2
+ * @since 08 april 2023
+ * @return parameter's value in lower case
+ */
+ fun testFunction(testParam: String?): String {
+ return testParam?.lowercase() ?: ""
+ }
+ }
+ """,
+ java =
+ """
+ /src/com/test/package0/TestClass.java
+ package com.test.package0;
+ public final class TestClass {
+ /**
+ * Testing @author @since @return method tags
+ * @since 1.2
+ * @since 08 april 2023
+ * @return parameter's value in lower case
+ */
+ public final String testFunction(String testParam) {
+ return testParam.toLowerCase();
+ }
+ }
+ """
+ ) {
+ val map = singlePageOfType<JavadocClasslikePageNode>().templateMap
+ assertEquals("TestClass", map["name"])
+
+ val methods = assertIsInstance<Map<String, Any?>>(map["methods"])
+ val testFunction = assertIsInstance<List<Map<String, Any?>>>(methods["own"]).single()
+ assertEquals("Testing @author @since @return method tags", testFunction["brief"])
+
+ assertEquals("testFunction", testFunction["name"])
+ assertEquals(listOf("<p>1.2</p>", "<p>08 april 2023</p>"), testFunction["sinceTagContent"])
+ assertEquals("<p>parameter's value in lower case</p>", testFunction["returnTagContent"])
+ }
+ }
+
+ @Test
+ fun `@author @since class tags`(){
+ dualTestTemplateMapInline(
+ kotlin =
+ """
+ /src/source0.kt
+ package com.test.package0
+ /**
+ * Testing @author @since class tags
+ * @author Test Author
+ * @author Test Author2
+ * @author Test Author3
+ * @since 1.2
+ * @since 08 april 2023
+ */
+ class TestClass {
+ fun testFunction(testParam: String?): String {
+ return testParam?.lowercase() ?: ""
+ }
+ }
+ """,
+ java =
+ """
+ /src/com/test/package0/TestClass.java
+ package com.test.package0;
+ /**
+ * Testing @author @since class tags
+ * @author Test Author
+ * @author Test Author2
+ * @author Test Author3
+ * @since 1.2
+ * @since 08 april 2023
+ */
+ public final class TestClass {
+ public final String testFunction(String testParam) {
+ return testParam.toLowerCase();
+ }
+ }
+ """
+ ) {
+ val map = singlePageOfType<JavadocClasslikePageNode>().templateMap
+
+ assertEquals("TestClass", map["name"])
+ assertEquals("<p>Testing @author @since class tags</p>", map["classlikeDocumentation"])
+ assertEquals(listOf("<p>Test Author</p>", "<p>Test Author2</p>", "<p>Test Author3</p>"), map["authorTagContent"])
+ assertEquals(listOf("<p>1.2</p>", "<p>08 april 2023</p>"), map["sinceTagContent"])
+ }
+ }
+
private fun assertParameterNode(node: Map<String, Any?>, expectedName: String, expectedType: String, expectedDescription: String){
assertEquals(expectedName, node["name"])
assertEquals(expectedType, node["type"])