aboutsummaryrefslogtreecommitdiff
path: root/test/src/model
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-09-09 14:54:19 +0200
committerDmitry Jemerov <yole@jetbrains.com>2015-09-09 14:54:19 +0200
commit1e862f2fc05c9d01d4d9c00de5d1a4235ff85a9d (patch)
tree147d9f03651404de595b81090767cefe38d9778b /test/src/model
parent60c915a9d35d8026bd2fc1a193b97b89cbf29621 (diff)
downloaddokka-1e862f2fc05c9d01d4d9c00de5d1a4235ff85a9d.tar.gz
dokka-1e862f2fc05c9d01d4d9c00de5d1a4235ff85a9d.tar.bz2
dokka-1e862f2fc05c9d01d4d9c00de5d1a4235ff85a9d.zip
render annotations with @; render only @MustBeDocumented annotations; render all modifiers
Diffstat (limited to 'test/src/model')
-rw-r--r--test/src/model/ClassTest.kt30
-rw-r--r--test/src/model/FunctionTest.kt54
-rw-r--r--test/src/model/PropertyTest.kt2
3 files changed, 57 insertions, 29 deletions
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index 05fc2fc3..bcedf49c 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -1,8 +1,11 @@
package org.jetbrains.dokka.tests
+import org.jetbrains.dokka.Content
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.DocumentationReference
import org.junit.Test
-import kotlin.test.*
-import org.jetbrains.dokka.*
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
public class ClassTest {
Test fun emptyClass() {
@@ -148,19 +151,24 @@ public class ClassTest {
}
}
- Test fun annotatedClass() {
- verifyModel("test/data/classes/annotatedClass.kt") { model ->
- with(model.members.single().members.single()) {
- assertEquals(1, annotations.count())
- with(annotations[0]) {
- assertEquals("data", name)
- assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
- }
+ @Test fun annotatedClass() {
+ verifyPackageMember("test/data/classes/annotatedClass.kt") { cls ->
+ assertEquals(1, cls.annotations.count())
+ with(cls.annotations[0]) {
+ assertEquals("Strictfp", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
}
}
}
+ @Test fun dataClass() {
+ verifyPackageMember("test/data/classes/dataClass.kt") { cls ->
+ val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("data" in modifiers)
+ }
+ }
+
Test fun annotatedClassWithAnnotationParameters() {
verifyModel("test/data/classes/annotatedClassWithAnnotationParameters.kt") { model ->
with(model.members.single().members.single()) {
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index 80ae223d..734675de 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -7,7 +7,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue
public class FunctionTest {
- Test fun function() {
+ @Test fun function() {
verifyModel("test/data/functions/function.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("fn", name)
@@ -20,7 +20,7 @@ public class FunctionTest {
}
}
- Test fun functionWithReceiver() {
+ @Test fun functionWithReceiver() {
verifyModel("test/data/functions/functionWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("String", name)
@@ -52,7 +52,7 @@ public class FunctionTest {
}
}
- Test fun genericFunction() {
+ @Test fun genericFunction() {
verifyModel("test/data/functions/genericFunction.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
@@ -76,7 +76,7 @@ public class FunctionTest {
}
}
}
- Test fun genericFunctionWithConstraints() {
+ @Test fun genericFunctionWithConstraints() {
verifyModel("test/data/functions/genericFunctionWithConstraints.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
@@ -115,7 +115,7 @@ public class FunctionTest {
}
}
- Test fun functionWithParams() {
+ @Test fun functionWithParams() {
verifyModel("test/data/functions/functionWithParams.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("function", name)
@@ -141,26 +141,37 @@ Documentation""", content.description.toTestString())
}
}
- Test fun annotatedFunction() {
- verifyModel("test/data/functions/annotatedFunction.kt") { model ->
- with(model.members.single().members.single()) {
- assertEquals(1, annotations.count())
- with(annotations[0]) {
- assertEquals("inline", name)
- assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
- }
+ @Test fun annotatedFunction() {
+ verifyPackageMember("test/data/functions/annotatedFunction.kt") { func ->
+ assertEquals(1, func.annotations.count())
+ with(func.annotations[0]) {
+ assertEquals("Strictfp", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
}
}
}
- Test fun functionWithAnnotatedParam() {
+ @Test fun functionWithNotDocumentedAnnotation() {
+ verifyPackageMember("test/data/functions/functionWithNotDocumentedAnnotation.kt") { func ->
+ assertEquals(0, func.annotations.count())
+ }
+ }
+
+ @Test fun inlineFunction() {
+ verifyPackageMember("test/data/functions/inlineFunction.kt") { func ->
+ val modifiers = func.details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("inline" in modifiers)
+ }
+ }
+
+ @Test fun functionWithAnnotatedParam() {
verifyModel("test/data/functions/functionWithAnnotatedParam.kt") { model ->
- with(model.members.single().members.single()) {
+ with(model.members.single().members.single { it.name == "function"} ) {
with(details.elementAt(2)) {
assertEquals(1, annotations.count())
with(annotations[0]) {
- assertEquals("noinline", name)
+ assertEquals("Fancy", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
}
@@ -169,6 +180,15 @@ Documentation""", content.description.toTestString())
}
}
+ @Test fun functionWithNoinlineParam() {
+ verifyPackageMember("test/data/functions/functionWithNoinlineParam.kt") { func ->
+ with(func.details.elementAt(2)) {
+ val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("noinline" in modifiers)
+ }
+ }
+ }
+
Test fun annotatedFunctionWithAnnotationParameters() {
verifyModel("test/data/functions/annotatedFunctionWithAnnotationParameters.kt") { model ->
with(model.members.single().members.single()) {
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index 405b260f..0853cbc5 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -69,7 +69,7 @@ public class PropertyTest {
with(model.members.single().members.single()) {
assertEquals(1, annotations.count())
with(annotations[0]) {
- assertEquals("inline", name)
+ assertEquals("Volatile", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
}