aboutsummaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2014-12-30 18:47:03 +0100
committerDmitry Jemerov <yole@jetbrains.com>2014-12-30 18:47:03 +0100
commit69dd2988ec98a9fa027fcc805f28efbe8758d476 (patch)
tree84badb429672162a55cb09ab082519b40cba3620 /test/src
parent716483c2f20e4af1951342f2acc9a231fcbeab3b (diff)
downloaddokka-69dd2988ec98a9fa027fcc805f28efbe8758d476.tar.gz
dokka-69dd2988ec98a9fa027fcc805f28efbe8758d476.tar.bz2
dokka-69dd2988ec98a9fa027fcc805f28efbe8758d476.zip
support and render annotation parameters
Diffstat (limited to 'test/src')
-rw-r--r--test/src/TestAPI.kt3
-rw-r--r--test/src/format/MarkdownFormatTest.kt6
-rw-r--r--test/src/model/ClassTest.kt44
-rw-r--r--test/src/model/FunctionTest.kt23
4 files changed, 76 insertions, 0 deletions
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index cc09f001..af1b8e52 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -7,6 +7,7 @@ import org.jetbrains.dokka.*
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
import java.io.File
import kotlin.test.assertEquals
+import com.intellij.openapi.application.PathManager
public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> Unit) {
val messageCollector = object : MessageCollector {
@@ -27,6 +28,8 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) ->
}
val environment = AnalysisEnvironment(messageCollector) {
+ val stringRoot = PathManager.getResourceRoot(javaClass<String>(), "/java/lang/String.class")
+ addClasspath(File(stringRoot))
addSources(files.toList())
}
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index a1fc7ac1..08267d32 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -31,4 +31,10 @@ public class MarkdownFormatTest {
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
+
+ Test fun annotationParams() {
+ verifyOutput("test/data/format/annotationParams.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
}
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index 257d73eb..ae82a4f1 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -179,4 +179,48 @@ public class ClassTest {
}
}
}
+
+ Test fun annotatedClassWithAnnotationParameters() {
+ verifyModel("test/data/classes/annotatedClassWithAnnotationParameters.kt") { model ->
+ with(model.members.single().members.single()) {
+ assertEquals(1, annotations.count())
+ with(annotations[0]) {
+ assertEquals("deprecated", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals("\"should no longer be used\"", name)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Test fun javaAnnotationClass() {
+ verifyModel("test/data/classes/javaAnnotationClass.kt") { model ->
+ with(model.members.single().members.single()) {
+ assertEquals(1, annotations.count())
+ with(annotations[0]) {
+ assertEquals("Retention", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals("RetentionPolicy.SOURCE", name)
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index d3d7843a..bf7471ea 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -163,4 +163,27 @@ Documentation""", content.description.toTestString())
}
}
}
+
+ Test fun annotatedFunctionWithAnnotationParameters() {
+ verifyModel("test/data/functions/annotatedFunctionWithAnnotationParameters.kt") { model ->
+ with(model.members.single().members.single()) {
+ assertEquals(1, annotations.count())
+ with(annotations[0]) {
+ assertEquals("inlineOptions", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(1, details.count())
+ with(details[0]) {
+ assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals("[InlineOption.LOCAL_CONTINUE_AND_BREAK]", name)
+ }
+ }
+ }
+ }
+ }
+ }
}
+