aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model
diff options
context:
space:
mode:
authorGoooler <wangzongler@gmail.com>2022-02-21 22:01:06 +0800
committerGitHub <noreply@github.com>2022-02-21 17:01:06 +0300
commitf5b7797255576e5f1c230e2ca3fcb5f4e602387c (patch)
tree25fd98250066c4ed6c2fff1104be533604bbf1b9 /plugins/base/src/test/kotlin/model
parentdf4780c31026aaa626746f49f0e6fa3fa0278a05 (diff)
downloaddokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.gz
dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.bz2
dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.zip
Code cleanups (#2165)
Diffstat (limited to 'plugins/base/src/test/kotlin/model')
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/CommentTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt7
4 files changed, 13 insertions, 12 deletions
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index b05ed4fb..920dea10 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -322,7 +322,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
constructors.map { it.name } allEquals "C"
- with(constructors.find { it.parameters.isNullOrEmpty() } notNull "C()") {
+ with(constructors.find { it.parameters.isEmpty() } notNull "C()") {
parameters counts 0
}
diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt
index 613576ae..59b1817a 100644
--- a/plugins/base/src/test/kotlin/model/CommentTest.kt
+++ b/plugins/base/src/test/kotlin/model/CommentTest.kt
@@ -175,11 +175,9 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
) {
with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\n\none: []"
- docs().find { it is CustomTagWrapper && it.name == "one" }.let {
- with(it.assertNotNull("'one' entry")) {
- root.children counts 0
- root.params.keys counts 0
- }
+ with(docs().find { it is CustomTagWrapper && it.name == "one" }.assertNotNull("'one' entry")) {
+ root.children counts 0
+ root.params.keys counts 0
}
}
}
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index eca5daea..29c81a65 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -44,7 +44,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
- it.name == "fn" && it.parameters.isNullOrEmpty()
+ it.name == "fn" && it.parameters.isEmpty()
}.assertNotNull("fn()")
val fn2 = functions.find {
it.name == "fn" && it.parameters.isNotEmpty()
@@ -81,7 +81,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
- it.name == "fn" && it.parameters.isNullOrEmpty()
+ it.name == "fn" && it.parameters.isEmpty()
}.assertNotNull("fn()")
val fn2 = functions.find {
it.name == "fn" && it.parameters.count() == 1
@@ -228,7 +228,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
with((this / "function" / "Fancy").cast<DAnnotation>()) {
with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) {
this counts 3
- with(map { it.dri.classNames to it }.toMap()) {
+ with(associate { it.dri.classNames to it }) {
with(this["Target"].assertNotNull("Target")) {
(params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf(
EnumValue(
@@ -298,7 +298,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) {
this counts 3
- with(map { it.dri.classNames to it }.toMap()) {
+ with(associate { it.dri.classNames to it }) {
with(this["Target"].assertNotNull("Target")) {
(params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf(
EnumValue(
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index aa132f6e..748ef190 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -52,7 +52,10 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
with((this / "fn").cast<DFunction>()) {
name equals "fn"
val params = parameters.map { it.documentation.values.first().children.first() as Param }
- params.mapNotNull { it.firstMemberOfType<Text>()?.body } equals listOf("is String parameter", "is int parameter")
+ params.map { it.firstMemberOfType<Text>().body } equals listOf(
+ "is String parameter",
+ "is int parameter"
+ )
}
}
}
@@ -160,7 +163,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
constructors counts 2
constructors.forEach { it.name equals "Test" }
- constructors.find { it.parameters.isNullOrEmpty() }.assertNotNull("Test()")
+ constructors.find { it.parameters.isEmpty() }.assertNotNull("Test()")
with(constructors.find { it.parameters.isNotEmpty() }.assertNotNull("Test(String)")) {
parameters.firstOrNull()?.type?.name equals "String"