aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/format
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2019-03-18 21:56:14 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2019-03-18 21:56:14 +0300
commit4b22ebab09ce3b934443d063df6b905e5347c390 (patch)
treef353662dc777107773adf8a5b3cac07b09ab3255 /core/src/test/kotlin/format
parent0fa9b69b6afe762e5aee7b7cf801a38ebe74b2c9 (diff)
parentb566f8852e94f9a17be86bf845aeff6c36bd8378 (diff)
downloaddokka-4b22ebab09ce3b934443d063df6b905e5347c390.tar.gz
dokka-4b22ebab09ce3b934443d063df6b905e5347c390.tar.bz2
dokka-4b22ebab09ce3b934443d063df6b905e5347c390.zip
Merge branch 'dev-pre' into dev
# Conflicts: # core/src/main/kotlin/Model/PackageDocs.kt
Diffstat (limited to 'core/src/test/kotlin/format')
-rw-r--r--core/src/test/kotlin/format/HtmlFormatTest.kt6
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt1
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt1
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt21
-rw-r--r--core/src/test/kotlin/format/PackageDocsTest.kt33
5 files changed, 55 insertions, 7 deletions
diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt
index 54c367fd..807118c5 100644
--- a/core/src/test/kotlin/format/HtmlFormatTest.kt
+++ b/core/src/test/kotlin/format/HtmlFormatTest.kt
@@ -1,9 +1,8 @@
package org.jetbrains.dokka.tests
import org.jetbrains.dokka.*
+import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
-import org.jetbrains.kotlin.config.KotlinSourceRoot
-import org.junit.Before
import org.junit.Test
import java.io.File
@@ -100,7 +99,8 @@ class HtmlFormatTest: FileGeneratorTestCase() {
}
@Test fun crossLanguageKotlinExtendsJava() {
- verifyOutput(arrayOf(KotlinSourceRoot("testdata/format/crossLanguage/kotlinExtendsJava/Bar.kt"),
+ verifyOutput(arrayOf(
+ KotlinSourceRoot("testdata/format/crossLanguage/kotlinExtendsJava/Bar.kt", false),
JavaSourceRoot(File("testdata/format/crossLanguage/kotlinExtendsJava"), null)),
".html") { model, output ->
buildPagesAndReadInto(
diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt
index b971b54d..062cf0b5 100644
--- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt
+++ b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt
@@ -54,6 +54,7 @@ class KotlinWebSiteFormatTest: FileGeneratorTestCase() {
outputFormat = "html",
generateIndexPages = false,
noStdlibLink = true,
+ noJdkLink = true,
languageVersion = null,
apiVersion = null
)
diff --git a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt
index 49fa6d2f..8076fb92 100644
--- a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt
+++ b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt
@@ -65,6 +65,7 @@ class KotlinWebSiteHtmlFormatTest: FileGeneratorTestCase() {
outputFormat = "kotlin-website-html",
generateIndexPages = false,
noStdlibLink = true,
+ noJdkLink = true,
languageVersion = null,
apiVersion = null
)
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index 9e4c831d..b078292b 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -109,7 +109,12 @@ class MarkdownFormatTest: FileGeneratorTestCase() {
}
@Test fun javaCodeInParam() {
- verifyJavaMarkdownNode("javaCodeInParam")
+ verifyJavaMarkdownNodes("javaCodeInParam") {
+ selectNodes(it) {
+ subgraphOf(RefKind.Member)
+ withKind(NodeKind.Function)
+ }
+ }
}
@Test fun javaSpaceInAuthor() {
@@ -160,6 +165,14 @@ class MarkdownFormatTest: FileGeneratorTestCase() {
verifyMarkdownNode("reifiedTypeParameter", withKotlinRuntime = true)
}
+ @Test fun suspendInlineFunctionOrder() {
+ verifyMarkdownNode("suspendInlineFunction", withKotlinRuntime = true)
+ }
+
+ @Test fun inlineSuspendFunctionOrderChanged() {
+ verifyMarkdownNode("inlineSuspendFunction", withKotlinRuntime = true)
+ }
+
@Test fun annotatedTypeParameter() {
verifyMarkdownNode("annotatedTypeParameter", withKotlinRuntime = true)
}
@@ -313,6 +326,7 @@ class MarkdownFormatTest: FileGeneratorTestCase() {
outputFormat = "html",
generateIndexPages = false,
noStdlibLink = true,
+ noJdkLink = true,
languageVersion = null,
apiVersion = null
)
@@ -447,6 +461,7 @@ class MarkdownFormatTest: FileGeneratorTestCase() {
outputFormat = "html",
generateIndexPages = false,
noStdlibLink = true,
+ noJdkLink = true,
languageVersion = null,
apiVersion = null
)
@@ -524,4 +539,8 @@ class MarkdownFormatTest: FileGeneratorTestCase() {
nodesWithName
}
}
+
+ @Test fun nullableTypeParameterFunction() {
+ verifyMarkdownNode("nullableTypeParameterFunction", withKotlinRuntime = true)
+ }
}
diff --git a/core/src/test/kotlin/format/PackageDocsTest.kt b/core/src/test/kotlin/format/PackageDocsTest.kt
index 704f7b99..3ff5f123 100644
--- a/core/src/test/kotlin/format/PackageDocsTest.kt
+++ b/core/src/test/kotlin/format/PackageDocsTest.kt
@@ -1,19 +1,46 @@
package org.jetbrains.dokka.tests.format
+import com.intellij.openapi.Disposable
+import com.intellij.openapi.util.Disposer
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.doAnswer
import com.nhaarman.mockito_kotlin.eq
import com.nhaarman.mockito_kotlin.mock
import org.jetbrains.dokka.*
import org.jetbrains.dokka.tests.assertEqualsIgnoringSeparators
+import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment
+import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
+import org.junit.After
import org.junit.Assert.assertEquals
+import org.junit.Before
import org.junit.Test
import java.io.File
class PackageDocsTest {
+
+ private lateinit var testDisposable: Disposable
+
+ @Before
+ fun setup() {
+ testDisposable = Disposer.newDisposable()
+ }
+
+ @After
+ fun cleanup() {
+ Disposer.dispose(testDisposable)
+ }
+
+ fun createPackageDocs(linkResolver: DeclarationLinkResolver?): PackageDocs {
+ val environment = KotlinCoreEnvironment.createForTests(testDisposable, CompilerConfiguration.EMPTY, EnvironmentConfigFiles.JVM_CONFIG_FILES)
+ return PackageDocs(linkResolver, DokkaConsoleLogger, environment, mock(), mock())
+ }
+
@Test fun verifyParse() {
- val docs = PackageDocs(null, DokkaConsoleLogger)
+
+ val docs = createPackageDocs(null)
docs.parse("testdata/packagedocs/stdlib.md", emptyList())
val packageContent = docs.packageContent["kotlin"]!!
val block = (packageContent.children.single() as ContentBlock).children.first() as ContentText
@@ -22,13 +49,13 @@ class PackageDocsTest {
@Test fun testReferenceLinksInPackageDocs() {
val mockLinkResolver = mock<DeclarationLinkResolver> {
- val exampleCom = "http://example.com"
+ val exampleCom = "https://example.com"
on { tryResolveContentLink(any(), eq(exampleCom)) } doAnswer { ContentExternalLink(exampleCom) }
}
val mockPackageDescriptor = mock<PackageFragmentDescriptor> {}
- val docs = PackageDocs(mockLinkResolver, DokkaConsoleLogger)
+ val docs = createPackageDocs(mockLinkResolver)
docs.parse("testdata/packagedocs/referenceLinks.md", listOf(mockPackageDescriptor))
checkMarkdownOutput(docs, "testdata/packagedocs/referenceLinks")