aboutsummaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt58
-rw-r--r--core/src/test/kotlin/model/ClassTest.kt70
-rw-r--r--core/src/test/kotlin/model/FunctionTest.kt46
-rw-r--r--core/src/test/kotlin/model/JavaTest.kt92
-rw-r--r--core/src/test/kotlin/model/KotlinAsJavaTest.kt8
-rw-r--r--core/src/test/kotlin/model/LinkTest.kt8
-rw-r--r--core/src/test/kotlin/model/PackageTest.kt14
-rw-r--r--core/src/test/kotlin/model/PropertyTest.kt30
8 files changed, 187 insertions, 139 deletions
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index e2339707..f306ac74 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -26,9 +26,13 @@ public class MarkdownFormatTest {
}
@Test fun annotationClass() {
- verifyOutput("testdata/format/annotationClass.kt", ".md") { model, output ->
- markdownService.appendNodes(tempLocation, output, model.members.single().members)
- }
+ verifyMarkdownNode("annotationClass", withKotlinRuntime = true)
+ verifyMarkdownPackage("annotationClass", withKotlinRuntime = true)
+ }
+
+ @Test fun exceptionClass() {
+ verifyMarkdownNode("exceptionClass", withKotlinRuntime = true)
+ verifyMarkdownPackage("exceptionClass", withKotlinRuntime = true)
}
@Test fun annotationParams() {
@@ -211,8 +215,52 @@ public class MarkdownFormatTest {
}
@Test fun inheritedExtensions() {
- verifyOutput("testdata/format/inheritedExtensions.kt", ".md") { model, output ->
- markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
+ verifyMarkdownNodeByName("inheritedExtensions", "Bar")
+ }
+
+ @Test fun arrayAverage() {
+ verifyMarkdownNodeByName("arrayAverage", "XArray")
+ }
+
+ @Test fun multipleTypeParameterConstraints() {
+ verifyMarkdownNode("multipleTypeParameterConstraints", withKotlinRuntime = true)
+ }
+
+ @Test fun inheritedCompanionObjectProperties() {
+ verifyMarkdownNodeByName("inheritedCompanionObjectProperties", "C")
+ }
+
+ @Test fun shadowedExtensionFunctions() {
+ verifyMarkdownNodeByName("shadowedExtensionFunctions", "Bar")
+ }
+
+ @Test fun inapplicableExtensionFunctions() {
+ verifyMarkdownNodeByName("inapplicableExtensionFunctions", "Bar")
+ }
+
+ @Test fun receiverParameterTypeBound() {
+ verifyMarkdownNodeByName("receiverParameterTypeBound", "Foo")
+ }
+
+ @Test fun jdkLinks() {
+ verifyMarkdownNode("jdkLinks", withKotlinRuntime = true)
+ }
+
+ private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) {
+ verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members)
+ }
+ }
+
+ private fun verifyMarkdownNode(fileName: String, withKotlinRuntime: Boolean = false) {
+ verifyOutput("testdata/format/$fileName.kt", ".md", withKotlinRuntime = withKotlinRuntime) { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
+ private fun verifyMarkdownNodeByName(fileName: String, name: String) {
+ verifyOutput("testdata/format/$fileName.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == name })
}
}
}
diff --git a/core/src/test/kotlin/model/ClassTest.kt b/core/src/test/kotlin/model/ClassTest.kt
index 981791c4..0a824f1c 100644
--- a/core/src/test/kotlin/model/ClassTest.kt
+++ b/core/src/test/kotlin/model/ClassTest.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.Content
-import org.jetbrains.dokka.DocumentationNode
-import org.jetbrains.dokka.DocumentationReference
+import org.jetbrains.dokka.NodeKind
+import org.jetbrains.dokka.RefKind
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -11,7 +11,7 @@ public class ClassTest {
@Test fun emptyClass() {
verifyModel("testdata/classes/emptyClass.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
assertEquals("<init>", members.single().name)
@@ -23,7 +23,7 @@ public class ClassTest {
@Test fun emptyObject() {
verifyModel("testdata/classes/emptyObject.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Object, kind)
+ assertEquals(NodeKind.Object, kind)
assertEquals("Obj", name)
assertEquals(Content.Empty, content)
assertTrue(members.none())
@@ -35,7 +35,7 @@ public class ClassTest {
@Test fun classWithConstructor() {
verifyModel("testdata/classes/classWithConstructor.kt") { model ->
with (model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
assertTrue(links.none())
@@ -44,12 +44,12 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Constructor, kind)
+ assertEquals(NodeKind.Constructor, kind)
assertEquals(2, details.count())
assertEquals("public", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("name", name)
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals(Content.Empty, content)
assertEquals("String", details.single().name)
assertTrue(links.none())
@@ -65,7 +65,7 @@ public class ClassTest {
@Test fun classWithFunction() {
verifyModel("testdata/classes/classWithFunction.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
assertTrue(links.none())
@@ -74,7 +74,7 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Constructor, kind)
+ assertEquals(NodeKind.Constructor, kind)
assertEquals(1, details.count())
assertEquals("public", details.elementAt(0).name)
assertTrue(links.none())
@@ -83,8 +83,8 @@ public class ClassTest {
with(members.elementAt(1)) {
assertEquals("fn", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
+ assertEquals(NodeKind.Function, kind)
+ assertEquals("Unit", detail(NodeKind.Type).name)
assertTrue(links.none())
assertTrue(members.none())
}
@@ -95,7 +95,7 @@ public class ClassTest {
@Test fun classWithProperty() {
verifyModel("testdata/classes/classWithProperty.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
assertTrue(links.none())
@@ -104,7 +104,7 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Constructor, kind)
+ assertEquals(NodeKind.Constructor, kind)
assertEquals(1, details.count())
assertEquals("public", details.elementAt(0).name)
assertTrue(members.none())
@@ -113,8 +113,8 @@ public class ClassTest {
with(members.elementAt(1)) {
assertEquals("name", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Property, kind)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
+ assertEquals(NodeKind.Property, kind)
+ assertEquals("String", detail(NodeKind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -125,7 +125,7 @@ public class ClassTest {
@Test fun classWithCompanionObject() {
verifyModel("testdata/classes/classWithCompanionObject.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
assertTrue(links.none())
@@ -137,13 +137,13 @@ public class ClassTest {
}
with(members.elementAt(1)) {
assertEquals("x", name)
- assertEquals(DocumentationNode.Kind.CompanionObjectProperty, kind)
+ assertEquals(NodeKind.CompanionObjectProperty, kind)
assertTrue(members.none())
assertTrue(links.none())
}
with(members.elementAt(2)) {
assertEquals("foo", name)
- assertEquals(DocumentationNode.Kind.CompanionObjectFunction, kind)
+ assertEquals(NodeKind.CompanionObjectFunction, kind)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -157,21 +157,21 @@ public class ClassTest {
with(cls.annotations[0]) {
assertEquals("Strictfp", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
}
}
}
@Test fun dataClass() {
verifyPackageMember("testdata/classes/dataClass.kt") { cls ->
- val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ val modifiers = cls.details(NodeKind.Modifier).map { it.name }
assertTrue("data" in modifiers)
}
}
@Test fun sealedClass() {
verifyPackageMember("testdata/classes/sealedClass.kt") { cls ->
- val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ val modifiers = cls.details(NodeKind.Modifier).map { it.name }
assertEquals(1, modifiers.count { it == "sealed" })
}
}
@@ -182,13 +182,13 @@ public class ClassTest {
with(deprecation!!) {
assertEquals("Deprecated", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals(NodeKind.Value, kind)
assertEquals("\"should no longer be used\"", name)
}
}
@@ -204,12 +204,12 @@ public class ClassTest {
with(annotations[0]) {
assertEquals("Retention", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals(NodeKind.Value, kind)
assertEquals("RetentionPolicy.SOURCE", name)
}
}
@@ -221,11 +221,11 @@ public class ClassTest {
@Test fun notOpenClass() {
verifyModel("testdata/classes/notOpenClass.kt") { model ->
with(model.members.single().members.first { it.name == "D"}.members.first { it.name == "f" }) {
- val modifiers = details(DocumentationNode.Kind.Modifier)
+ val modifiers = details(NodeKind.Modifier)
assertEquals(2, modifiers.size)
assertEquals("final", modifiers[1].name)
- val overrideReferences = references(DocumentationReference.Kind.Override)
+ val overrideReferences = references(RefKind.Override)
assertEquals(1, overrideReferences.size)
}
}
@@ -234,11 +234,11 @@ public class ClassTest {
@Test fun indirectOverride() {
verifyModel("testdata/classes/indirectOverride.kt") { model ->
with(model.members.single().members.first { it.name == "E"}.members.first { it.name == "foo" }) {
- val modifiers = details(DocumentationNode.Kind.Modifier)
+ val modifiers = details(NodeKind.Modifier)
assertEquals(2, modifiers.size)
assertEquals("final", modifiers[1].name)
- val overrideReferences = references(DocumentationReference.Kind.Override)
+ val overrideReferences = references(RefKind.Override)
assertEquals(1, overrideReferences.size)
}
}
@@ -247,7 +247,7 @@ public class ClassTest {
@Test fun innerClass() {
verifyPackageMember("testdata/classes/innerClass.kt") { cls ->
val innerClass = cls.members.single { it.name == "D" }
- val modifiers = innerClass.details(DocumentationNode.Kind.Modifier)
+ val modifiers = innerClass.details(NodeKind.Modifier)
assertEquals(3, modifiers.size)
assertEquals("inner", modifiers[2].name)
}
@@ -257,16 +257,16 @@ public class ClassTest {
verifyModel("testdata/classes/companionObjectExtension.kt") { model ->
val pkg = model.members.single()
val cls = pkg.members.single { it.name == "Foo" }
- val extensions = cls.extensions.filter { it.kind == DocumentationNode.Kind.CompanionObjectProperty }
+ val extensions = cls.extensions.filter { it.kind == NodeKind.CompanionObjectProperty }
assertEquals(1, extensions.size)
}
}
@Test fun secondaryConstructor() {
verifyPackageMember("testdata/classes/secondaryConstructor.kt") { cls ->
- val constructors = cls.members(DocumentationNode.Kind.Constructor)
+ val constructors = cls.members(NodeKind.Constructor)
assertEquals(2, constructors.size)
- with (constructors.first { it.details(DocumentationNode.Kind.Parameter).size == 1}) {
+ with (constructors.first { it.details(NodeKind.Parameter).size == 1}) {
assertEquals("<init>", name)
assertEquals("This is a secondary constructor.", summary.toTestString())
}
diff --git a/core/src/test/kotlin/model/FunctionTest.kt b/core/src/test/kotlin/model/FunctionTest.kt
index 83fd8223..0a65b640 100644
--- a/core/src/test/kotlin/model/FunctionTest.kt
+++ b/core/src/test/kotlin/model/FunctionTest.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.Content
-import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.NodeKind
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -11,9 +11,9 @@ public class FunctionTest {
verifyModel("testdata/functions/function.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("fn", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("Function fn", content.summary.toTestString())
- assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("Unit", detail(NodeKind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -24,17 +24,17 @@ public class FunctionTest {
verifyModel("testdata/functions/functionWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("kotlin.String", name)
- assertEquals(DocumentationNode.Kind.ExternalClass, kind)
+ assertEquals(NodeKind.ExternalClass, kind)
assertEquals(2, members.count())
with(members[0]) {
assertEquals("fn", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("Function with receiver", content.summary.toTestString())
assertEquals("public", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("<this>", name)
- assertEquals(DocumentationNode.Kind.Receiver, kind)
+ assertEquals(NodeKind.Receiver, kind)
assertEquals(Content.Empty, content)
assertEquals("String", details.single().name)
assertTrue(members.none())
@@ -46,7 +46,7 @@ public class FunctionTest {
}
with(members[1]) {
assertEquals("fn", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
}
}
}
@@ -56,14 +56,14 @@ public class FunctionTest {
verifyModel("testdata/functions/genericFunction.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("generic function", content.summary.toTestString())
assertEquals("private", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("T", name)
- assertEquals(DocumentationNode.Kind.TypeParameter, kind)
+ assertEquals(NodeKind.TypeParameter, kind)
assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
@@ -80,18 +80,18 @@ public class FunctionTest {
verifyModel("testdata/functions/genericFunctionWithConstraints.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("generic function", content.summary.toTestString())
assertEquals("public", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("T", name)
- assertEquals(DocumentationNode.Kind.TypeParameter, kind)
+ assertEquals(NodeKind.TypeParameter, kind)
assertEquals(Content.Empty, content)
with(details.single()) {
assertEquals("R", name)
- assertEquals(DocumentationNode.Kind.UpperBound, kind)
+ assertEquals(NodeKind.UpperBound, kind)
assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
@@ -102,7 +102,7 @@ public class FunctionTest {
}
with(details.elementAt(3)) {
assertEquals("R", name)
- assertEquals(DocumentationNode.Kind.TypeParameter, kind)
+ assertEquals(NodeKind.TypeParameter, kind)
assertEquals(Content.Empty, content)
assertTrue(members.none())
assertTrue(links.none())
@@ -119,7 +119,7 @@ public class FunctionTest {
verifyModel("testdata/functions/functionWithParams.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("function", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("Multiline", content.summary.toTestString())
assertEquals("""Function
Documentation""", content.description.toTestString())
@@ -128,7 +128,7 @@ Documentation""", content.description.toTestString())
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("x", name)
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals("parameter", content.summary.toTestString())
assertEquals("Int", details.single().name)
assertTrue(members.none())
@@ -147,7 +147,7 @@ Documentation""", content.description.toTestString())
with(func.annotations[0]) {
assertEquals("Strictfp", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
}
}
}
@@ -160,7 +160,7 @@ Documentation""", content.description.toTestString())
@Test fun inlineFunction() {
verifyPackageMember("testdata/functions/inlineFunction.kt") { func ->
- val modifiers = func.details(DocumentationNode.Kind.Modifier).map { it.name }
+ val modifiers = func.details(NodeKind.Modifier).map { it.name }
assertTrue("inline" in modifiers)
}
}
@@ -173,7 +173,7 @@ Documentation""", content.description.toTestString())
with(annotations[0]) {
assertEquals("Fancy", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
}
}
}
@@ -183,7 +183,7 @@ Documentation""", content.description.toTestString())
@Test fun functionWithNoinlineParam() {
verifyPackageMember("testdata/functions/functionWithNoinlineParam.kt") { func ->
with(func.details.elementAt(2)) {
- val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
+ val modifiers = details(NodeKind.Modifier).map { it.name }
assertTrue("noinline" in modifiers)
}
}
@@ -196,13 +196,13 @@ Documentation""", content.description.toTestString())
with(annotations[0]) {
assertEquals("Fancy", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals(NodeKind.Value, kind)
assertEquals("1", name)
}
}
@@ -215,7 +215,7 @@ Documentation""", content.description.toTestString())
verifyModel("testdata/functions/functionWithDefaultParameter.kt") { model ->
with(model.members.single().members.single()) {
with(details.elementAt(2)) {
- val value = details(DocumentationNode.Kind.Value)
+ val value = details(NodeKind.Value)
assertEquals(1, value.count())
with(value[0]) {
assertEquals("\"\"", name)
diff --git a/core/src/test/kotlin/model/JavaTest.kt b/core/src/test/kotlin/model/JavaTest.kt
index 903260d3..3d6f2e75 100644
--- a/core/src/test/kotlin/model/JavaTest.kt
+++ b/core/src/test/kotlin/model/JavaTest.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.tests
-import org.jetbrains.dokka.DocumentationNode
-import org.jetbrains.dokka.DocumentationReference
+import org.jetbrains.dokka.NodeKind
+import org.jetbrains.dokka.RefKind
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
@@ -11,8 +11,8 @@ public class JavaTest {
@Test fun function() {
verifyJavaPackageMember("testdata/java/member.java") { cls ->
assertEquals("Test", cls.name)
- assertEquals(DocumentationNode.Kind.Class, cls.kind)
- with(cls.members(DocumentationNode.Kind.Function).single()) {
+ assertEquals(NodeKind.Class, cls.kind)
+ with(cls.members(NodeKind.Function).single()) {
assertEquals("fn", name)
assertEquals("Summary for Function", content.summary.toTestString().trimEnd())
assertEquals(3, content.sections.size)
@@ -30,16 +30,16 @@ public class JavaTest {
assertEquals("Author", tag)
assertEquals("yole", toTestString())
}
- assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("Unit", detail(NodeKind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
with(details.first { it.name == "name" }) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
+ assertEquals(NodeKind.Parameter, kind)
+ assertEquals("String", detail(NodeKind.Type).name)
}
with(details.first { it.name == "value" }) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
- assertEquals("Int", detail(DocumentationNode.Kind.Type).name)
+ assertEquals(NodeKind.Parameter, kind)
+ assertEquals("Int", detail(NodeKind.Type).name)
}
}
}
@@ -47,7 +47,7 @@ public class JavaTest {
@Test fun memberWithModifiers() {
verifyJavaPackageMember("testdata/java/memberWithModifiers.java") { cls ->
- val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ val modifiers = cls.details(NodeKind.Modifier).map { it.name }
assertTrue("abstract" in modifiers)
with(cls.members.single { it.name == "fn" }) {
assertEquals("protected", details[0].name)
@@ -60,7 +60,7 @@ public class JavaTest {
@Test fun superClass() {
verifyJavaPackageMember("testdata/java/superClass.java") { cls ->
- val superTypes = cls.details(DocumentationNode.Kind.Supertype)
+ val superTypes = cls.details(NodeKind.Supertype)
assertEquals(2, superTypes.size)
assertEquals("Exception", superTypes[0].name)
assertEquals("Cloneable", superTypes[1].name)
@@ -69,12 +69,12 @@ public class JavaTest {
@Test fun arrayType() {
verifyJavaPackageMember("testdata/java/arrayType.java") { cls ->
- with(cls.members(DocumentationNode.Kind.Function).single()) {
- val type = detail(DocumentationNode.Kind.Type)
+ with(cls.members(NodeKind.Function).single()) {
+ val type = detail(NodeKind.Type)
assertEquals("Array", type.name)
- assertEquals("String", type.detail(DocumentationNode.Kind.Type).name)
- with(details(DocumentationNode.Kind.Parameter).single()) {
- val parameterType = detail(DocumentationNode.Kind.Type)
+ assertEquals("String", type.detail(NodeKind.Type).name)
+ with(details(NodeKind.Parameter).single()) {
+ val parameterType = detail(NodeKind.Type)
assertEquals("IntArray", parameterType.name)
}
}
@@ -83,16 +83,16 @@ public class JavaTest {
@Test fun typeParameter() {
verifyJavaPackageMember("testdata/java/typeParameter.java") { cls ->
- val typeParameters = cls.details(DocumentationNode.Kind.TypeParameter)
+ val typeParameters = cls.details(NodeKind.TypeParameter)
with(typeParameters.single()) {
assertEquals("T", name)
- with(detail(DocumentationNode.Kind.UpperBound)) {
+ with(detail(NodeKind.UpperBound)) {
assertEquals("Comparable", name)
- assertEquals("T", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("T", detail(NodeKind.Type).name)
}
}
- with(cls.members(DocumentationNode.Kind.Function).single()) {
- val methodTypeParameters = details(DocumentationNode.Kind.TypeParameter)
+ with(cls.members(NodeKind.Function).single()) {
+ val methodTypeParameters = details(NodeKind.TypeParameter)
with(methodTypeParameters.single()) {
assertEquals("E", name)
}
@@ -102,7 +102,7 @@ public class JavaTest {
@Test fun constructors() {
verifyJavaPackageMember("testdata/java/constructors.java") { cls ->
- val constructors = cls.members(DocumentationNode.Kind.Constructor)
+ val constructors = cls.members(NodeKind.Constructor)
assertEquals(2, constructors.size)
with(constructors[0]) {
assertEquals("<init>", name)
@@ -112,39 +112,39 @@ public class JavaTest {
@Test fun innerClass() {
verifyJavaPackageMember("testdata/java/innerClass.java") { cls ->
- val innerClass = cls.members(DocumentationNode.Kind.Class).single()
+ val innerClass = cls.members(NodeKind.Class).single()
assertEquals("D", innerClass.name)
}
}
@Test fun varargs() {
verifyJavaPackageMember("testdata/java/varargs.java") { cls ->
- val fn = cls.members(DocumentationNode.Kind.Function).single()
- val param = fn.detail(DocumentationNode.Kind.Parameter)
- assertEquals("vararg", param.details(DocumentationNode.Kind.Modifier).first().name)
- val psiType = param.detail(DocumentationNode.Kind.Type)
+ val fn = cls.members(NodeKind.Function).single()
+ val param = fn.detail(NodeKind.Parameter)
+ assertEquals("vararg", param.details(NodeKind.Modifier).first().name)
+ val psiType = param.detail(NodeKind.Type)
assertEquals("String", psiType.name)
- assertTrue(psiType.details(DocumentationNode.Kind.Type).isEmpty())
+ assertTrue(psiType.details(NodeKind.Type).isEmpty())
}
}
@Test fun fields() {
verifyJavaPackageMember("testdata/java/field.java") { cls ->
- val i = cls.members(DocumentationNode.Kind.Property).single { it.name == "i" }
- assertEquals("Int", i.detail(DocumentationNode.Kind.Type).name)
- assertTrue("var" in i.details(DocumentationNode.Kind.Modifier).map { it.name })
-
- val s = cls.members(DocumentationNode.Kind.Property).single { it.name == "s" }
- assertEquals("String", s.detail(DocumentationNode.Kind.Type).name)
- assertFalse("var" in s.details(DocumentationNode.Kind.Modifier).map { it.name })
- assertTrue("static" in s.details(DocumentationNode.Kind.Modifier).map { it.name })
+ val i = cls.members(NodeKind.Property).single { it.name == "i" }
+ assertEquals("Int", i.detail(NodeKind.Type).name)
+ assertTrue("var" in i.details(NodeKind.Modifier).map { it.name })
+
+ val s = cls.members(NodeKind.Property).single { it.name == "s" }
+ assertEquals("String", s.detail(NodeKind.Type).name)
+ assertFalse("var" in s.details(NodeKind.Modifier).map { it.name })
+ assertTrue("static" in s.details(NodeKind.Modifier).map { it.name })
}
}
@Test fun staticMethod() {
verifyJavaPackageMember("testdata/java/staticMethod.java") { cls ->
- val m = cls.members(DocumentationNode.Kind.Function).single { it.name == "foo" }
- assertTrue("static" in m.details(DocumentationNode.Kind.Modifier).map { it.name })
+ val m = cls.members(NodeKind.Function).single { it.name == "foo" }
+ assertTrue("static" in m.details(NodeKind.Modifier).map { it.name })
}
}
@@ -154,10 +154,10 @@ public class JavaTest {
with(cls.annotations[0]) {
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Parameter, kind)
+ assertEquals(NodeKind.Parameter, kind)
assertEquals(1, details.count())
with(details[0]) {
- assertEquals(DocumentationNode.Kind.Value, kind)
+ assertEquals(NodeKind.Value, kind)
assertEquals("[AnnotationTarget.FIELD, AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]", name)
}
}
@@ -167,30 +167,30 @@ public class JavaTest {
@Test fun deprecation() {
verifyJavaPackageMember("testdata/java/deprecation.java") { cls ->
- val fn = cls.members(DocumentationNode.Kind.Function).single()
+ val fn = cls.members(NodeKind.Function).single()
assertEquals("This should no longer be used", fn.deprecation!!.content.toTestString())
}
}
@Test fun javaLangObject() {
verifyJavaPackageMember("testdata/java/javaLangObject.java") { cls ->
- val fn = cls.members(DocumentationNode.Kind.Function).single()
- assertEquals("Any", fn.detail(DocumentationNode.Kind.Type).name)
+ val fn = cls.members(NodeKind.Function).single()
+ assertEquals("Any", fn.detail(NodeKind.Type).name)
}
}
@Test fun enumValues() {
verifyJavaPackageMember("testdata/java/enumValues.java") { cls ->
- val superTypes = cls.details(DocumentationNode.Kind.Supertype)
+ val superTypes = cls.details(NodeKind.Supertype)
assertEquals(0, superTypes.size)
- assertEquals(1, cls.members(DocumentationNode.Kind.EnumItem).size)
+ assertEquals(1, cls.members(NodeKind.EnumItem).size)
}
}
@Test fun inheritorLinks() {
verifyJavaPackageMember("testdata/java/inheritorLinks.java") { cls ->
val fooClass = cls.members.single { it.name == "Foo" }
- val inheritors = fooClass.references(DocumentationReference.Kind.Inheritor)
+ val inheritors = fooClass.references(RefKind.Inheritor)
assertEquals(1, inheritors.size)
}
}
diff --git a/core/src/test/kotlin/model/KotlinAsJavaTest.kt b/core/src/test/kotlin/model/KotlinAsJavaTest.kt
index b439d399..fab307f3 100644
--- a/core/src/test/kotlin/model/KotlinAsJavaTest.kt
+++ b/core/src/test/kotlin/model/KotlinAsJavaTest.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.DocumentationModule
-import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.NodeKind
import org.junit.Test
import kotlin.test.assertEquals
@@ -11,11 +11,11 @@ class KotlinAsJavaTest {
val pkg = model.members.single()
val facadeClass = pkg.members.single { it.name == "FunctionKt" }
- assertEquals(DocumentationNode.Kind.Class, facadeClass.kind)
+ assertEquals(NodeKind.Class, facadeClass.kind)
val fn = facadeClass.members.single()
assertEquals("fn", fn.name)
- assertEquals(DocumentationNode.Kind.Function, fn.kind)
+ assertEquals(NodeKind.Function, fn.kind)
}
}
@@ -23,7 +23,7 @@ class KotlinAsJavaTest {
verifyModelAsJava("testdata/comments/oneLineDoc.kt") { model ->
val facadeClass = model.members.single().members.single { it.name == "OneLineDocKt" }
val getter = facadeClass.members.single { it.name == "getProperty" }
- assertEquals(DocumentationNode.Kind.Function, getter.kind)
+ assertEquals(NodeKind.Function, getter.kind)
assertEquals("doc", getter.content.summary.toTestString())
}
}
diff --git a/core/src/test/kotlin/model/LinkTest.kt b/core/src/test/kotlin/model/LinkTest.kt
index ac49cae6..bcb1007c 100644
--- a/core/src/test/kotlin/model/LinkTest.kt
+++ b/core/src/test/kotlin/model/LinkTest.kt
@@ -9,7 +9,7 @@ public class LinkTest {
verifyModel("testdata/links/linkToSelf.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("This is link to [Foo -> Class:Foo]", content.summary.toTestString())
}
}
@@ -19,7 +19,7 @@ public class LinkTest {
verifyModel("testdata/links/linkToMember.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("This is link to [member -> Function:member]", content.summary.toTestString())
}
}
@@ -39,7 +39,7 @@ public class LinkTest {
verifyModel("testdata/links/linkToQualifiedMember.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
- assertEquals(DocumentationNode.Kind.Class, kind)
+ assertEquals(NodeKind.Class, kind)
assertEquals("This is link to [Foo.member -> Function:member]", content.summary.toTestString())
}
}
@@ -49,7 +49,7 @@ public class LinkTest {
verifyModel("testdata/links/linkToParam.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals(NodeKind.Function, kind)
assertEquals("This is link to [param -> Parameter:param]", content.summary.toTestString())
}
}
diff --git a/core/src/test/kotlin/model/PackageTest.kt b/core/src/test/kotlin/model/PackageTest.kt
index aa5a059a..edb5d989 100644
--- a/core/src/test/kotlin/model/PackageTest.kt
+++ b/core/src/test/kotlin/model/PackageTest.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.Content
-import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.NodeKind
import org.jetbrains.kotlin.config.KotlinSourceRoot
import org.junit.Test
import kotlin.test.assertEquals
@@ -11,7 +11,7 @@ public class PackageTest {
@Test fun rootPackage() {
verifyModel("testdata/packages/rootPackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals("", name)
assertEquals(Content.Empty, content)
assertTrue(details.none())
@@ -24,7 +24,7 @@ public class PackageTest {
@Test fun simpleNamePackage() {
verifyModel("testdata/packages/simpleNamePackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals("simple", name)
assertEquals(Content.Empty, content)
assertTrue(details.none())
@@ -37,7 +37,7 @@ public class PackageTest {
@Test fun dottedNamePackage() {
verifyModel("testdata/packages/dottedNamePackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals("dot.name", name)
assertEquals(Content.Empty, content)
assertTrue(details.none())
@@ -52,7 +52,7 @@ public class PackageTest {
KotlinSourceRoot("testdata/packages/simpleNamePackage.kt")) { model ->
assertEquals(2, model.members.count())
with(model.members.single { it.name == "simple" }) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals("simple", name)
assertEquals(Content.Empty, content)
assertTrue(details.none())
@@ -60,7 +60,7 @@ public class PackageTest {
assertTrue(links.none())
}
with(model.members.single { it.name == "dot.name" }) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
@@ -74,7 +74,7 @@ public class PackageTest {
KotlinSourceRoot("testdata/packages/simpleNamePackage2.kt")) { model ->
assertEquals(1, model.members.count())
with(model.members.elementAt(0)) {
- assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals(NodeKind.Package, kind)
assertEquals("simple", name)
assertEquals(Content.Empty, content)
assertTrue(details.none())
diff --git a/core/src/test/kotlin/model/PropertyTest.kt b/core/src/test/kotlin/model/PropertyTest.kt
index 716aac54..a049979d 100644
--- a/core/src/test/kotlin/model/PropertyTest.kt
+++ b/core/src/test/kotlin/model/PropertyTest.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.Content
-import org.jetbrains.dokka.DocumentationNode
-import org.jetbrains.dokka.DocumentationReference
+import org.jetbrains.dokka.NodeKind
+import org.jetbrains.dokka.RefKind
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -12,9 +12,9 @@ public class PropertyTest {
verifyModel("testdata/properties/valueProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNode.Kind.Property, kind)
+ assertEquals(NodeKind.Property, kind)
assertEquals(Content.Empty, content)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("String", detail(NodeKind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -25,9 +25,9 @@ public class PropertyTest {
verifyModel("testdata/properties/variableProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNode.Kind.Property, kind)
+ assertEquals(NodeKind.Property, kind)
assertEquals(Content.Empty, content)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("String", detail(NodeKind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -38,9 +38,9 @@ public class PropertyTest {
verifyModel("testdata/properties/valuePropertyWithGetter.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNode.Kind.Property, kind)
+ assertEquals(NodeKind.Property, kind)
assertEquals(Content.Empty, content)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
+ assertEquals("String", detail(NodeKind.Type).name)
assertTrue(links.none())
assertTrue(members.none())
}
@@ -51,10 +51,10 @@ public class PropertyTest {
verifyModel("testdata/properties/variablePropertyWithAccessors.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNode.Kind.Property, kind)
+ assertEquals(NodeKind.Property, kind)
assertEquals(Content.Empty, content)
- assertEquals("String", detail(DocumentationNode.Kind.Type).name)
- val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertEquals("String", detail(NodeKind.Type).name)
+ val modifiers = details(NodeKind.Modifier).map { it.name }
assertTrue("final" in modifiers)
assertTrue("public" in modifiers)
assertTrue("var" in modifiers)
@@ -71,7 +71,7 @@ public class PropertyTest {
with(annotations[0]) {
assertEquals("Volatile", name)
assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
+ assertEquals(NodeKind.Annotation, kind)
}
}
}
@@ -81,10 +81,10 @@ public class PropertyTest {
verifyModel("testdata/properties/propertyWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("kotlin.String", name)
- assertEquals(DocumentationNode.Kind.ExternalClass, kind)
+ assertEquals(NodeKind.ExternalClass, kind)
with(members.single()) {
assertEquals("foobar", name)
- assertEquals(DocumentationNode.Kind.Property, kind)
+ assertEquals(NodeKind.Property, kind)
}
}
}
@@ -94,7 +94,7 @@ public class PropertyTest {
verifyModel("testdata/properties/propertyOverride.kt") { model ->
with(model.members.single().members.single { it.name == "Bar" }.members.single { it.name == "xyzzy"}) {
assertEquals("xyzzy", name)
- val override = references(DocumentationReference.Kind.Override).single().to
+ val override = references(RefKind.Override).single().to
assertEquals("xyzzy", override.name)
assertEquals("Foo", override.owner!!.name)
}