aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model
diff options
context:
space:
mode:
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.kt6
-rw-r--r--plugins/base/src/test/kotlin/model/ExtensionsTest.kt9
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt435
-rw-r--r--plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt7
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt3
6 files changed, 228 insertions, 234 deletions
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index 920dea10..6a3e80cd 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -1,6 +1,7 @@
package model
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.links.TypeConstructor
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.KotlinModifier.*
@@ -10,7 +11,6 @@ import utils.AbstractModelTest
import utils.assertNotNull
import utils.name
import utils.supers
-import org.jetbrains.dokka.links.TypeConstructor
class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt
index 7f2151bc..cd149209 100644
--- a/plugins/base/src/test/kotlin/model/CommentTest.kt
+++ b/plugins/base/src/test/kotlin/model/CommentTest.kt
@@ -3,9 +3,11 @@ package model
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DProperty
import org.jetbrains.dokka.model.doc.*
-import org.jetbrains.dokka.model.doc.Br
import org.junit.jupiter.api.Test
-import utils.*
+import utils.AbstractModelTest
+import utils.assertNotNull
+import utils.comments
+import utils.docs
class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comment") {
diff --git a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
index f2657ef8..e28b442f 100644
--- a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
@@ -1,10 +1,13 @@
package model
import org.jetbrains.dokka.base.transformers.documentables.CallableExtensions
-import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.DClass
+import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DInterface
+import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
-import org.jetbrains.dokka.model.properties.WithExtraProperties
class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
private fun <T : WithExtraProperties<R>, R : Documentable> T.checkExtension(name: String = "extension") =
@@ -149,4 +152,4 @@ class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "cl
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
index 265bb7a0..641f6ef5 100644
--- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
@@ -1,18 +1,12 @@
package model
import org.jetbrains.dokka.Platform
-import org.jetbrains.dokka.analysis.DokkaAnalysisConfiguration
-import org.jetbrains.dokka.analysis.ProjectKotlinAnalysis
-import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.transformers.documentables.InheritorsInfo
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.DInterface
import org.jetbrains.dokka.model.doc.P
import org.jetbrains.dokka.model.doc.Text
-import org.jetbrains.dokka.plugability.DokkaPlugin
-import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
-import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
@@ -155,220 +149,221 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
}
}
- class IgnoreCommonBuiltInsPlugin : DokkaPlugin() {
- private val dokkaBase by lazy { plugin<DokkaBase>() }
- @Suppress("unused")
- val stdLibKotlinAnalysis by extending {
- dokkaBase.kotlinAnalysis providing { ctx ->
- ProjectKotlinAnalysis(
- sourceSets = ctx.configuration.sourceSets,
- logger = ctx.logger,
- analysisConfiguration = DokkaAnalysisConfiguration(ignoreCommonBuiltIns = true)
- )
- } override dokkaBase.defaultKotlinAnalysis
- }
-
- @OptIn(DokkaPluginApiPreview::class)
- override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement =
- PluginApiPreviewAcknowledgement
- }
- @Test
- fun `should inherit docs for stdLib #2638`() {
- val testConfiguration = dokkaConfiguration {
- suppressObviousFunctions = false
- sourceSets {
- sourceSet {
- sourceRoots = listOf("src/")
- analysisPlatform = "common"
- languageVersion = "1.4"
- }
- }
- }
-
- inlineModelTest(
- """
- package kotlin.collections
-
- import kotlin.internal.PlatformDependent
-
- /**
- * Classes that inherit from this interface can be represented as a sequence of elements that can
- * be iterated over.
- * @param T the type of element being iterated over. The iterator is covariant in its element type.
- */
- public interface Iterable<out T> {
- /**
- * Returns an iterator over the elements of this object.
- */
- public operator fun iterator(): Iterator<T>
- }
-
- /**
- * Classes that inherit from this interface can be represented as a sequence of elements that can
- * be iterated over and that supports removing elements during iteration.
- * @param T the type of element being iterated over. The mutable iterator is invariant in its element type.
- */
- public interface MutableIterable<out T> : Iterable<T> {
- /**
- * Returns an iterator over the elements of this sequence that supports removing elements during iteration.
- */
- override fun iterator(): MutableIterator<T>
- }
-
- /**
- * A generic collection of elements. Methods in this interface support only read-only access to the collection;
- * read/write access is supported through the [MutableCollection] interface.
- * @param E the type of elements contained in the collection. The collection is covariant in its element type.
- */
- public interface Collection<out E> : Iterable<E> {
- // Query Operations
- /**
- * Returns the size of the collection.
- */
- public val size: Int
-
- /**
- * Returns `true` if the collection is empty (contains no elements), `false` otherwise.
- */
- public fun isEmpty(): Boolean
-
- /**
- * Checks if the specified element is contained in this collection.
- */
- public operator fun contains(element: @UnsafeVariance E): Boolean
-
- override fun iterator(): Iterator<E>
-
- // Bulk Operations
- /**
- * Checks if all elements in the specified collection are contained in this collection.
- */
- public fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
- }
-
- /**
- * A generic collection of elements that supports adding and removing elements.
- *
- * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type.
- */
- public interface MutableCollection<E> : Collection<E>, MutableIterable<E> {
- // Query Operations
- override fun iterator(): MutableIterator<E>
-
- // Modification Operations
- /**
- * Adds the specified element to the collection.
- *
- * @return `true` if the element has been added, `false` if the collection does not support duplicates
- * and the element is already contained in the collection.
- */
- public fun add(element: E): Boolean
-
- /**
- * Removes a single instance of the specified element from this
- * collection, if it is present.
- *
- * @return `true` if the element has been successfully removed; `false` if it was not present in the collection.
- */
- public fun remove(element: E): Boolean
-
- // Bulk Modification Operations
- /**
- * Adds all of the elements of the specified collection to this collection.
- *
- * @return `true` if any of the specified elements was added to the collection, `false` if the collection was not modified.
- */
- public fun addAll(elements: Collection<E>): Boolean
-
- /**
- * Removes all of this collection's elements that are also contained in the specified collection.
- *
- * @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.
- */
- public fun removeAll(elements: Collection<E>): Boolean
-
- /**
- * Retains only the elements in this collection that are contained in the specified collection.
- *
- * @return `true` if any element was removed from the collection, `false` if the collection was not modified.
- */
- public fun retainAll(elements: Collection<E>): Boolean
-
- /**
- * Removes all elements from this collection.
- */
- public fun clear(): Unit
- }
-
- /**
- * A generic ordered collection of elements. Methods in this interface support only read-only access to the list;
- * read/write access is supported through the [MutableList] interface.
- * @param E the type of elements contained in the list. The list is covariant in its element type.
- */
- public interface List<out E> : Collection<E> {
- // Query Operations
-
- override val size: Int
- override fun isEmpty(): Boolean
- override fun contains(element: @UnsafeVariance E): Boolean
- override fun iterator(): Iterator<E>
-
- // Bulk Operations
- override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
-
- // Positional Access Operations
- /**
- * Returns the element at the specified index in the list.
- */
- public operator fun get(index: Int): E
-
- // Search Operations
- /**
- * Returns the index of the first occurrence of the specified element in the list, or -1 if the specified
- * element is not contained in the list.
- */
- public fun indexOf(element: @UnsafeVariance E): Int
-
- /**
- * Returns the index of the last occurrence of the specified element in the list, or -1 if the specified
- * element is not contained in the list.
- */
- public fun lastIndexOf(element: @UnsafeVariance E): Int
-
- // List Iterators
- /**
- * Returns a list iterator over the elements in this list (in proper sequence).
- */
- public fun listIterator(): ListIterator<E>
-
- /**
- * Returns a list iterator over the elements in this list (in proper sequence), starting at the specified [index].
- */
- public fun listIterator(index: Int): ListIterator<E>
-
- // View
- /**
- * Returns a view of the portion of this list between the specified [fromIndex] (inclusive) and [toIndex] (exclusive).
- * The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.
- *
- * Structural changes in the base list make the behavior of the view undefined.
- */
- public fun subList(fromIndex: Int, toIndex: Int): List<E>
- }
-
- // etc
- """.trimMargin(),
- platform = Platform.common.toString(),
- configuration = testConfiguration,
- prependPackage = false,
- pluginsOverrides = listOf(IgnoreCommonBuiltInsPlugin())
- ) {
- with((this / "kotlin.collections" / "List" / "contains").cast<DFunction>()) {
- documentation.size equals 1
-
- }
- }
- }
+// TODO [beresnev] fix, needs access to analysis
+// class IgnoreCommonBuiltInsPlugin : DokkaPlugin() {
+// private val kotlinAnalysisPlugin by lazy { plugin<DescriptorKotlinAnalysisPlugin>() }
+// @Suppress("unused")
+// val stdLibKotlinAnalysis by extending {
+// kotlinAnalysisPlugin.kotlinAnalysis providing { ctx ->
+// ProjectKotlinAnalysis(
+// sourceSets = ctx.configuration.sourceSets,
+// logger = ctx.logger,
+// analysisConfiguration = DokkaAnalysisConfiguration(ignoreCommonBuiltIns = true)
+// )
+// } override kotlinAnalysisPlugin.defaultKotlinAnalysis
+// }
+//
+// @OptIn(DokkaPluginApiPreview::class)
+// override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement =
+// PluginApiPreviewAcknowledgement
+// }
+// @Test
+// fun `should inherit docs for stdLib #2638`() {
+// val testConfiguration = dokkaConfiguration {
+// suppressObviousFunctions = false
+// sourceSets {
+// sourceSet {
+// sourceRoots = listOf("src/")
+// analysisPlatform = "common"
+// languageVersion = "1.4"
+// }
+// }
+// }
+//
+// inlineModelTest(
+// """
+// package kotlin.collections
+//
+// import kotlin.internal.PlatformDependent
+//
+// /**
+// * Classes that inherit from this interface can be represented as a sequence of elements that can
+// * be iterated over.
+// * @param T the type of element being iterated over. The iterator is covariant in its element type.
+// */
+// public interface Iterable<out T> {
+// /**
+// * Returns an iterator over the elements of this object.
+// */
+// public operator fun iterator(): Iterator<T>
+// }
+//
+// /**
+// * Classes that inherit from this interface can be represented as a sequence of elements that can
+// * be iterated over and that supports removing elements during iteration.
+// * @param T the type of element being iterated over. The mutable iterator is invariant in its element type.
+// */
+// public interface MutableIterable<out T> : Iterable<T> {
+// /**
+// * Returns an iterator over the elements of this sequence that supports removing elements during iteration.
+// */
+// override fun iterator(): MutableIterator<T>
+// }
+//
+// /**
+// * A generic collection of elements. Methods in this interface support only read-only access to the collection;
+// * read/write access is supported through the [MutableCollection] interface.
+// * @param E the type of elements contained in the collection. The collection is covariant in its element type.
+// */
+// public interface Collection<out E> : Iterable<E> {
+// // Query Operations
+// /**
+// * Returns the size of the collection.
+// */
+// public val size: Int
+//
+// /**
+// * Returns `true` if the collection is empty (contains no elements), `false` otherwise.
+// */
+// public fun isEmpty(): Boolean
+//
+// /**
+// * Checks if the specified element is contained in this collection.
+// */
+// public operator fun contains(element: @UnsafeVariance E): Boolean
+//
+// override fun iterator(): Iterator<E>
+//
+// // Bulk Operations
+// /**
+// * Checks if all elements in the specified collection are contained in this collection.
+// */
+// public fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
+// }
+//
+// /**
+// * A generic collection of elements that supports adding and removing elements.
+// *
+// * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type.
+// */
+// public interface MutableCollection<E> : Collection<E>, MutableIterable<E> {
+// // Query Operations
+// override fun iterator(): MutableIterator<E>
+//
+// // Modification Operations
+// /**
+// * Adds the specified element to the collection.
+// *
+// * @return `true` if the element has been added, `false` if the collection does not support duplicates
+// * and the element is already contained in the collection.
+// */
+// public fun add(element: E): Boolean
+//
+// /**
+// * Removes a single instance of the specified element from this
+// * collection, if it is present.
+// *
+// * @return `true` if the element has been successfully removed; `false` if it was not present in the collection.
+// */
+// public fun remove(element: E): Boolean
+//
+// // Bulk Modification Operations
+// /**
+// * Adds all of the elements of the specified collection to this collection.
+// *
+// * @return `true` if any of the specified elements was added to the collection, `false` if the collection was not modified.
+// */
+// public fun addAll(elements: Collection<E>): Boolean
+//
+// /**
+// * Removes all of this collection's elements that are also contained in the specified collection.
+// *
+// * @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.
+// */
+// public fun removeAll(elements: Collection<E>): Boolean
+//
+// /**
+// * Retains only the elements in this collection that are contained in the specified collection.
+// *
+// * @return `true` if any element was removed from the collection, `false` if the collection was not modified.
+// */
+// public fun retainAll(elements: Collection<E>): Boolean
+//
+// /**
+// * Removes all elements from this collection.
+// */
+// public fun clear(): Unit
+// }
+//
+// /**
+// * A generic ordered collection of elements. Methods in this interface support only read-only access to the list;
+// * read/write access is supported through the [MutableList] interface.
+// * @param E the type of elements contained in the list. The list is covariant in its element type.
+// */
+// public interface List<out E> : Collection<E> {
+// // Query Operations
+//
+// override val size: Int
+// override fun isEmpty(): Boolean
+// override fun contains(element: @UnsafeVariance E): Boolean
+// override fun iterator(): Iterator<E>
+//
+// // Bulk Operations
+// override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
+//
+// // Positional Access Operations
+// /**
+// * Returns the element at the specified index in the list.
+// */
+// public operator fun get(index: Int): E
+//
+// // Search Operations
+// /**
+// * Returns the index of the first occurrence of the specified element in the list, or -1 if the specified
+// * element is not contained in the list.
+// */
+// public fun indexOf(element: @UnsafeVariance E): Int
+//
+// /**
+// * Returns the index of the last occurrence of the specified element in the list, or -1 if the specified
+// * element is not contained in the list.
+// */
+// public fun lastIndexOf(element: @UnsafeVariance E): Int
+//
+// // List Iterators
+// /**
+// * Returns a list iterator over the elements in this list (in proper sequence).
+// */
+// public fun listIterator(): ListIterator<E>
+//
+// /**
+// * Returns a list iterator over the elements in this list (in proper sequence), starting at the specified [index].
+// */
+// public fun listIterator(index: Int): ListIterator<E>
+//
+// // View
+// /**
+// * Returns a view of the portion of this list between the specified [fromIndex] (inclusive) and [toIndex] (exclusive).
+// * The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.
+// *
+// * Structural changes in the base list make the behavior of the view undefined.
+// */
+// public fun subList(fromIndex: Int, toIndex: Int): List<E>
+// }
+//
+// // etc
+// """.trimMargin(),
+// platform = Platform.common.toString(),
+// configuration = testConfiguration,
+// prependPackage = false,
+// pluginsOverrides = listOf(IgnoreCommonBuiltInsPlugin())
+// ) {
+// with((this / "kotlin.collections" / "List" / "contains").cast<DFunction>()) {
+// documentation.size equals 1
+//
+// }
+// }
+// }
@Test
fun `should inherit docs in case of diamond inheritance`() {
diff --git a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
index a163f7f4..5fe17fc8 100644
--- a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
+++ b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
@@ -3,13 +3,10 @@ package model
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.PointingToDeclaration
-import org.jetbrains.dokka.model.childrenOfType
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.model.doc.*
-import org.jetbrains.dokka.model.firstMemberOfType
import org.jetbrains.dokka.model.withDescendants
-import org.jetbrains.dokka.pages.ContentText
-import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
+import org.jetbrains.dokka.utilities.firstIsInstanceOrNull
import org.junit.jupiter.api.Test
import translators.documentationOf
import utils.docs
@@ -361,4 +358,4 @@ class MultiLanguageInheritanceTest : BaseAbstractTest() {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt
index 1047d6cf..d38667bf 100644
--- a/plugins/base/src/test/kotlin/model/PropertyTest.kt
+++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt
@@ -1,13 +1,10 @@
package model
-import org.jetbrains.dokka.links.Callable
-import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import utils.assertNotNull
import utils.name
-import kotlin.test.assertEquals
class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "property") {