aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt5
-rw-r--r--plugins/base/src/test/kotlin/issues/IssuesTest.kt18
-rw-r--r--plugins/base/src/test/kotlin/markdown/KDocTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt60
-rw-r--r--plugins/base/src/test/kotlin/model/CommentTest.kt32
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt18
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt38
-rw-r--r--plugins/base/src/test/kotlin/model/PackagesTest.kt16
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt20
-rw-r--r--plugins/base/src/test/kotlin/utils/ModelUtils.kt6
-rw-r--r--plugins/base/src/test/kotlin/utils/TestUtils.kt8
11 files changed, 109 insertions, 116 deletions
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index ea3238a5..34e92d82 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -1,9 +1,8 @@
package enums
-import org.jetbrains.dokka.model.Enum
+import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.pages.ClasslikePageNode
import org.jetbrains.dokka.pages.ModulePageNode
-import org.junit.Assert
import org.junit.Assert.*
import org.junit.Test
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
@@ -72,7 +71,7 @@ class EnumsTest : AbstractCoreTest() {
p.first().classlikes.let { c ->
assertTrue("Classlikes list cannot be empty", c.isNotEmpty())
- val enum = c.first() as Enum
+ val enum = c.first() as DEnum
assertEquals(enum.name, "Test")
assertEquals(enum.entries.count(), 2)
assertNotNull(enum.companion)
diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
index ea2f0f8e..e34c610a 100644
--- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt
+++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
@@ -1,7 +1,7 @@
package issues
-import org.jetbrains.dokka.model.Class
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DClass
+import org.jetbrains.dokka.model.DFunction
import org.junit.Test
import utils.AbstractModelTest
@@ -33,16 +33,16 @@ class IssuesTest : AbstractModelTest("/src/main/kotlin/issues/Test.kt", "issues"
|}
"""
) {
- with((this / "issues" / "Test").cast<Class>()) {
+ with((this / "issues" / "Test").cast<DClass>()) {
// passes
- (this / "working").cast<Function>().type.constructorFqName equals "kotlin.String"
- (this / "doSomething").cast<Function>().type.constructorFqName equals "kotlin.String"
+ (this / "working").cast<DFunction>().type.constructorFqName equals "kotlin.String"
+ (this / "doSomething").cast<DFunction>().type.constructorFqName equals "kotlin.String"
// fails
- (this / "brokenGenerics").cast<Function>().type.constructorFqName equals "kotlin.collections.List"
- (this / "brokenApply").cast<Function>().type.constructorFqName equals "issues.Test"
- (this / "brokenRun").cast<Function>().type.constructorFqName equals "issues.Test"
- (this / "brokenLet").cast<Function>().type.constructorFqName equals "issues.Test"
+ (this / "brokenGenerics").cast<DFunction>().type.constructorFqName equals "kotlin.collections.List"
+ (this / "brokenApply").cast<DFunction>().type.constructorFqName equals "issues.Test"
+ (this / "brokenRun").cast<DFunction>().type.constructorFqName equals "issues.Test"
+ (this / "brokenLet").cast<DFunction>().type.constructorFqName equals "issues.Test"
}
}
}
diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
index e250670a..fa538c3e 100644
--- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
@@ -1,6 +1,6 @@
package markdown
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DPackage
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.pages.ModulePageNode
import org.junit.Assert
@@ -26,7 +26,7 @@ open class KDocTest : AbstractCoreTest() {
""".trimMargin()
private fun actualDocumentationNode(modulePageNode: ModulePageNode) =
- (modulePageNode.documentable?.children?.first() as Package)
+ (modulePageNode.documentable?.children?.first() as DPackage)
.classlikes.single()
.documentation.values.single()
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index a59174bf..d627dab4 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -2,7 +2,7 @@ package model
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.KotlinModifier.*
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.junit.Test
import utils.AbstractModelTest
import utils.assertNotNull
@@ -17,7 +17,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""
|class Klass {}"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 4
}
@@ -31,7 +31,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|object Obj {}
"""
) {
- with((this / "classes" / "Obj").cast<Object>()) {
+ with((this / "classes" / "Obj").cast<DObject>()) {
name equals "Obj"
children counts 3
}
@@ -45,7 +45,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|class Klass(name: String)
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 4
@@ -71,11 +71,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
type.constructorFqName equals "kotlin.Unit"
parameters counts 0
visibility.values allEquals KotlinVisibility.Public
@@ -93,11 +93,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "name").cast<Property>()) {
+ with((this / "name").cast<DProperty>()) {
name equals "name"
// TODO property name
}
@@ -117,19 +117,19 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "Companion").cast<Object>()) {
+ with((this / "Companion").cast<DObject>()) {
name equals "Companion"
children counts 5
- with((this / "x").cast<Property>()) {
+ with((this / "x").cast<DProperty>()) {
name equals "x"
}
- with((this / "foo").cast<Function>()) {
+ with((this / "foo").cast<DFunction>()) {
name equals "foo"
parameters counts 0
type.constructorFqName equals "kotlin.Unit"
@@ -146,7 +146,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|data class Klass() {}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
visibility.values allEquals KotlinVisibility.Public
with(extra[AdditionalModifiers.AdditionalKey].assertNotNull("Extras")) {
@@ -170,7 +170,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|sealed class Klass() {}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
modifier equals KotlinModifier.Sealed
}
@@ -215,18 +215,18 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- val C = (this / "classes" / "C").cast<Class>()
- val D = (this / "classes" / "D").cast<Class>()
+ val C = (this / "classes" / "C").cast<DClass>()
+ val D = (this / "classes" / "D").cast<DClass>()
with(C) {
modifier equals Open
- with((this / "f").cast<Function>()) {
+ with((this / "f").cast<DFunction>()) {
modifier equals Open
}
}
with(D) {
modifier equals Final
- with((this / "f").cast<Function>()) {
+ with((this / "f").cast<DFunction>()) {
modifier equals Open
}
D.supertypes.flatMap { it.component2() }.firstOrNull() equals C.dri
@@ -249,13 +249,13 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- val C = (this / "classes" / "C").cast<Class>()
- val D = (this / "classes" / "D").cast<Class>()
- val E = (this / "classes" / "E").cast<Class>()
+ val C = (this / "classes" / "C").cast<DClass>()
+ val D = (this / "classes" / "D").cast<DClass>()
+ val E = (this / "classes" / "E").cast<DClass>()
with(C) {
modifier equals Abstract
- ((this / "foo").cast<Function>()).modifier equals Abstract
+ ((this / "foo").cast<DFunction>()).modifier equals Abstract
}
with(D) {
@@ -280,9 +280,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "C").cast<Class>()) {
+ with((this / "classes" / "C").cast<DClass>()) {
- with((this / "D").cast<Class>()) {
+ with((this / "D").cast<DClass>()) {
}
}
}
@@ -312,10 +312,10 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|val Klass.Default.x: Int get() = 1
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
- with((this / "Default").cast<Object>()) {
+ with((this / "Default").cast<DObject>()) {
name equals "Default"
// TODO extensions
}
@@ -342,7 +342,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "C").cast<Class>()) {
+ with((this / "classes" / "C").cast<DClass>()) {
name equals "C"
constructors counts 2
@@ -384,14 +384,14 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
- with((this / "Companion").cast<Object>()) {
+ with((this / "Companion").cast<DObject>()) {
name equals "Companion"
visibility.values allEquals KotlinVisibility.Private
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
name equals "fn"
parameters counts 0
receiver equals null
diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt
index d576cf49..055892af 100644
--- a/plugins/base/src/test/kotlin/model/CommentTest.kt
+++ b/plugins/base/src/test/kotlin/model/CommentTest.kt
@@ -1,6 +1,6 @@
package model
-import org.jetbrains.dokka.model.Property
+import org.jetbrains.dokka.model.DProperty
import org.jetbrains.dokka.model.doc.CustomWrapperTag
import org.jetbrains.dokka.model.doc.Text
import org.junit.Test
@@ -28,7 +28,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val prop2 = ""
"""
) {
- with((this / "comment" / "prop1").cast<Property>()) {
+ with((this / "comment" / "prop1").cast<DProperty>()) {
name equals "prop1"
with(this.docs().firstOrNull()?.root.assertNotNull("Code")) {
(children.firstOrNull() as? Text)
@@ -37,7 +37,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
params["lang"] equals "brainfuck"
}
}
- with((this / "comment" / "prop2").cast<Property>()) {
+ with((this / "comment" / "prop2").cast<DProperty>()) {
name equals "prop2"
comments() equals "a + b - c"
}
@@ -51,7 +51,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
name equals "property"
comments() equals ""
}
@@ -68,7 +68,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
"""
) {
val p = this
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals ""
}
}
@@ -87,7 +87,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc1\ndoc2 doc3"
}
}
@@ -107,7 +107,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc1\ndoc2 doc3"
}
}
@@ -121,7 +121,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -136,7 +136,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -151,7 +151,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -168,7 +168,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: []"
docs().find { it is CustomWrapperTag && it.name == "one" }.let {
with(it.assertNotNull("'one' entry")) {
@@ -188,7 +188,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals """it's "useful""""
}
}
@@ -205,7 +205,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [section one]"
}
}
@@ -224,7 +224,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [section one]\ntwo: [section two]"
}
}
@@ -243,7 +243,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [line one line two]"
}
}
@@ -290,7 +290,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|}
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
this
}
}
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index 9554ad02..f3a7adc7 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -1,7 +1,7 @@
package model
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DPackage
import org.junit.Test
import utils.*
@@ -17,7 +17,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun fn() {}
"""
) {
- with((this / "function" / "fn").cast<Function>()) {
+ with((this / "function" / "fn").cast<DFunction>()) {
name equals "fn"
type.constructorFqName equals "kotlin.Unit"
this.children.assertCount(0, "Function children: ")
@@ -39,7 +39,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun fn(i: Int) {}
"""
) {
- with((this / "function").cast<Package>()) {
+ with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
it.name == "fn" && it.parameters.isNullOrEmpty()
}.assertNotNull("fn()")
@@ -76,7 +76,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun String.fn(x: Int) {}
"""
) {
- with((this / "function").cast<Package>()) {
+ with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
it.name == "fn" && it.parameters.isNullOrEmpty()
}.assertNotNull("fn()")
@@ -114,7 +114,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|}
"""
) {
- with((this / "function" / "function").cast<Function>()) {
+ with((this / "function" / "function").cast<DFunction>()) {
comments() equals "Multiline\nFunction Documentation"
name equals "function"
@@ -141,7 +141,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add annotations
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No annotation data" }
}
}
@@ -162,7 +162,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add data about inline
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No inline data" }
}
}
@@ -184,7 +184,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add data about suspend
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No suspend data" }
}
}
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index ea454763..c2545e7a 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -1,8 +1,8 @@
package model
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.junit.Assert.assertTrue
import org.junit.Test
import utils.AbstractModelTest
@@ -24,10 +24,10 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
children counts 1
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
name equals "fn"
this
}
@@ -82,7 +82,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test" / "fn").cast<Function>()) {
+ with((this / "java" / "Test" / "fn").cast<DFunction>()) {
this
}
}
@@ -108,7 +108,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|public class Foo extends Exception implements Cloneable {}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
val sups = listOf("Exception", "Cloneable")
assertTrue(
"Foo must extend ${sups.joinToString(", ")}",
@@ -128,11 +128,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
children counts 1
- with((this / "arrayToString").cast<Function>()) {
+ with((this / "arrayToString").cast<DFunction>()) {
name equals "arrayToString"
type.constructorFqName equals "java.lang.String[]"
with(parameters.firstOrNull().assertNotNull("parameters")) {
@@ -153,7 +153,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
this
}
}
@@ -189,7 +189,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
constructors counts 2
@@ -211,9 +211,9 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "InnerClass").cast<Class>()) {
+ with((this / "java" / "InnerClass").cast<DClass>()) {
children counts 1
- with((this / "D").cast<Class>()) {
+ with((this / "D").cast<DClass>()) {
name equals "D"
children counts 0
}
@@ -230,11 +230,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
name equals "Foo"
children counts 1
- with((this / "bar").cast<Function>()) {
+ with((this / "bar").cast<DFunction>()) {
name equals "bar"
with(parameters.firstOrNull().assertNotNull("parameter")) {
name equals "x"
@@ -255,15 +255,15 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
children counts 2
- with((this / "i").cast<Property>()) {
+ with((this / "i").cast<DProperty>()) {
getter.assertNotNull("i.get")
setter.assertNotNull("i.set")
}
- with((this / "s").cast<Property>()) {
+ with((this / "s").cast<DProperty>()) {
getter.assertNotNull("s.get")
setter.assertNotNull("s.set")
@@ -344,11 +344,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "E").cast<Enum>()) {
+ with((this / "java" / "E").cast<DEnum>()) {
name equals "E"
entries counts 1
- with((this / "Foo").cast<EnumEntry>()) {
+ with((this / "Foo").cast<DEnumEntry>()) {
name equals "Foo"
}
}
diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt
index e19cc82d..008ae14d 100644
--- a/plugins/base/src/test/kotlin/model/PackagesTest.kt
+++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt
@@ -1,6 +1,6 @@
package model
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DPackage
import org.junit.Test
import utils.AbstractModelTest
@@ -14,7 +14,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "").cast<Package>()) {
+ with((this / "").cast<DPackage>()) {
name equals ""
children counts 0
}
@@ -29,7 +29,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -44,7 +44,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "dot.name").cast<Package>()) {
+ with((this / "dot.name").cast<DPackage>()) {
name equals "dot.name"
children counts 0
}
@@ -63,11 +63,11 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
prependPackage = false
) {
children counts 2
- with((this / "dot.name").cast<Package>()) {
+ with((this / "dot.name").cast<DPackage>()) {
name equals "dot.name"
children counts 0
}
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -85,7 +85,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
prependPackage = false
) {
children counts 1
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -102,7 +102,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "simple.name").cast<Package>()) {
+ with((this / "simple.name").cast<DPackage>()) {
name equals "simple.name"
children counts 1
}
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt
index e4ef0aec..d12e292b 100644
--- a/plugins/base/src/test/kotlin/model/PropertyTest.kt
+++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt
@@ -1,8 +1,8 @@
package model
import org.jetbrains.dokka.model.KotlinVisibility
-import org.jetbrains.dokka.model.Package
-import org.jetbrains.dokka.model.Property
+import org.jetbrains.dokka.model.DPackage
+import org.jetbrains.dokka.model.DProperty
import org.junit.Test
import utils.AbstractModelTest
import utils.assertNotNull
@@ -15,7 +15,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
"""
|val property = "test""""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
@@ -33,7 +33,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
|var property = "test"
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
setter.assertNotNull("Setter")
@@ -53,7 +53,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| get() = "test"
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
@@ -73,7 +73,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| set(value) {}
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
setter.assertNotNull("Setter")
@@ -93,7 +93,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| get() = size() * 2
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(receiver.assertNotNull("property receiver")) {
@@ -120,15 +120,15 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
|}
"""
) {
- with((this / "property").cast<Package>()) {
- with((this / "Foo" / "property").cast<Property>()) {
+ with((this / "property").cast<DPackage>()) {
+ with((this / "Foo" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
type.constructorFqName equals "kotlin.Int"
}
}
- with((this / "Bar" / "property").cast<Property>()) {
+ with((this / "Bar" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
index 75c8e008..1e6f64c6 100644
--- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
@@ -1,8 +1,6 @@
package utils
-import org.jetbrains.dokka.model.Module
-import org.jetbrains.dokka.model.doc.DocumentationNode
-import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.jetbrains.dokka.model.DModule
abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL {
@@ -11,7 +9,7 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
platform: String = "jvm",
targetList: List<String> = listOf("jvm"),
prependPackage: Boolean = true,
- block: Module.() -> Unit
+ block: DModule.() -> Unit
) {
val configuration = dokkaConfiguration {
passes {
diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt
index 6913ba5b..bf86c1b1 100644
--- a/plugins/base/src/test/kotlin/utils/TestUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt
@@ -1,13 +1,9 @@
package utils
-import org.jetbrains.dokka.model.Class
+import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Property
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
-import kotlin.reflect.KClass
-import kotlin.reflect.full.safeCast
@DslMarker
annotation class TestDSL
@@ -64,5 +60,5 @@ fun <T> T?.assertNotNull(name: String = ""): T = this ?: throw AssertionError("$
fun <T : Documentable> T?.docs() = this?.documentation.orEmpty().values.flatMap { it.children }
-val Class.supers
+val DClass.supers
get() = supertypes.flatMap{it.component2()} \ No newline at end of file