aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/classes/annotatedClassWithAnnotationParameters.kt1
-rw-r--r--test/data/classes/javaAnnotationClass.kt5
-rw-r--r--test/data/format/annotationParams.kt1
-rw-r--r--test/data/format/annotationParams.md12
-rw-r--r--test/data/functions/annotatedFunctionWithAnnotationParameters.kt1
-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
9 files changed, 96 insertions, 0 deletions
diff --git a/test/data/classes/annotatedClassWithAnnotationParameters.kt b/test/data/classes/annotatedClassWithAnnotationParameters.kt
new file mode 100644
index 00000000..1af97e75
--- /dev/null
+++ b/test/data/classes/annotatedClassWithAnnotationParameters.kt
@@ -0,0 +1 @@
+deprecated("should no longer be used") class Foo() {}
diff --git a/test/data/classes/javaAnnotationClass.kt b/test/data/classes/javaAnnotationClass.kt
new file mode 100644
index 00000000..c5f5cac4
--- /dev/null
+++ b/test/data/classes/javaAnnotationClass.kt
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention
+import java.lang.annotation.RetentionPolicy
+
+Retention(RetentionPolicy.SOURCE)
+public annotation class throws()
diff --git a/test/data/format/annotationParams.kt b/test/data/format/annotationParams.kt
new file mode 100644
index 00000000..ee5b524a
--- /dev/null
+++ b/test/data/format/annotationParams.kt
@@ -0,0 +1 @@
+inlineOptions(InlineOption.LOCAL_CONTINUE_AND_BREAK) fun f() {}
diff --git a/test/data/format/annotationParams.md b/test/data/format/annotationParams.md
new file mode 100644
index 00000000..6bbdc0e5
--- /dev/null
+++ b/test/data/format/annotationParams.md
@@ -0,0 +1,12 @@
+[test](out.md) / [](out.md) / [f](out.md)
+
+
+# f
+
+
+```
+inlineOptions([InlineOption.LOCAL_CONTINUE_AND_BREAK]) fun f(): Unit
+```
+
+
+
diff --git a/test/data/functions/annotatedFunctionWithAnnotationParameters.kt b/test/data/functions/annotatedFunctionWithAnnotationParameters.kt
new file mode 100644
index 00000000..ee5b524a
--- /dev/null
+++ b/test/data/functions/annotatedFunctionWithAnnotationParameters.kt
@@ -0,0 +1 @@
+inlineOptions(InlineOption.LOCAL_CONTINUE_AND_BREAK) fun f() {}
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)
+ }
+ }
+ }
+ }
+ }
+ }
}
+