diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-08-11 21:47:26 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-19 13:34:10 +0200 |
commit | 852a6ce6c0f43c9b2044320dcceb4c6cc0a3b302 (patch) | |
tree | fb95be79e816769ca5305cf3a601348549000c6d /integration-tests/gradle/src/integrationTest/kotlin | |
parent | 822653f017fa58352148e1c586690debb6773965 (diff) | |
download | dokka-852a6ce6c0f43c9b2044320dcceb4c6cc0a3b302.tar.gz dokka-852a6ce6c0f43c9b2044320dcceb4c6cc0a3b302.tar.bz2 dokka-852a6ce6c0f43c9b2044320dcceb4c6cc0a3b302.zip |
Refactor location providers
Diffstat (limited to 'integration-tests/gradle/src/integrationTest/kotlin')
-rw-r--r-- | integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt index 6d71f161..c24ca75b 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt @@ -62,6 +62,13 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst "Expected html files in html output directory" ) + htmlOutputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLinksIgnoringKnown(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + } + assertTrue( htmlOutputDir.allHtmlFiles().any { file -> "https://developer.android.com/reference/android/content/Context.html" in file.readText() @@ -81,4 +88,22 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst assertNoHrefToMissingLocalFileOrDirectory(file) } } + + // TODO: use [assertNoUnresolvedLinks] instead when https://github.com/Kotlin/dokka/issues/1306 is closed + private fun assertNoUnresolvedLinksIgnoringKnown(file: File) { + val knownUnresolvedDRIs = setOf( + "it.android/IntegrationTestActivity/findViewById/#kotlin.Int/PointingToGenericParameters(0)/", + "it.android/IntegrationTestActivity/getExtraData/#java.lang.Class[TypeParam(bounds=[androidx.core.app.ComponentActivity.ExtraData])]/PointingToGenericParameters(0)/", + "it.android/IntegrationTestActivity/getSystemService/#java.lang.Class[TypeParam(bounds=[kotlin.Any])]/PointingToGenericParameters(0)/", + "it.android/IntegrationTestActivity/requireViewById/#kotlin.Int/PointingToGenericParameters(0)/" + ) + val fileText = file.readText() + val regex = Regex("""data-unresolved-link="\[(.+?(?=]"))""") + val match = regex.findAll(fileText).map { it.groups[1]!!.value } + + assertTrue( + match.filterNot { it in knownUnresolvedDRIs }.toList().isEmpty(), + "Unexpected unresolved link in ${file.path}\n" + fileText + ) + } } |