Skip to content

Commit

Permalink
Add a test for sourceSet without classes, only having functions
Browse files Browse the repository at this point in the history
(This test fails at time of writing)
  • Loading branch information
owengray-google committed Aug 1, 2023
1 parent 2c01749 commit 4662a93
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Expand Up @@ -33,6 +33,7 @@ kotlin {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
}
}
val otherMain by sourceSets.creating { dependsOn(commonMain) }
}
}

Expand Down
@@ -0,0 +1,3 @@
package it.mpp0

fun CommonMainClass.otherMainFunction() = 5
Expand Up @@ -38,5 +38,6 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions)
assertNoEmptyLinks(file)
assertNoEmptySpans(file)
}
assertStringExistsInOutput(dokkaOutputDir.allHtmlFiles().toList(), "otherMainFunction")
}
}
Expand Up @@ -165,4 +165,11 @@ abstract class AbstractIntegrationTest {
)
}
}

protected fun assertStringExistsInOutput(outputFiles: List<File>, expectedString: String) {
outputFiles.forEach {
if (expectedString in it.readText()) return
}
assert(false) { "failed to find $expectedString in any output file!" }
}
}

0 comments on commit 4662a93

Please sign in to comment.