From a547235b41cb3c5d8a2dfb50923bf1ec2d3cd620 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Fri, 14 Aug 2020 13:38:36 +0200 Subject: Implement ignoring known unresolved links in integration tests --- .../kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'integration-tests/src/main/kotlin/org') diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt index c2f4f49b..04ae4a88 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -42,11 +42,13 @@ abstract class AbstractIntegrationTest { ) } - protected fun assertNoUnresolvedLinks(file: File) { - val regex = Regex("data-unresolved-link") + protected fun assertNoUnresolvedLinks(file: File, exceptions: Set = emptySet()) { val fileText = file.readText() - assertFalse( - fileText.contains(regex), + val regex = Regex("""data-unresolved-link="\[(.+?(?=]"))""") + val match = regex.findAll(fileText).map { it.groups[1]!!.value } + + assertTrue( + match.filterNot { it in exceptions }.toList().isEmpty(), "Unexpected unresolved link in ${file.path}\n" + fileText ) } -- cgit