Refactor multiplatform test cases in MultiModuleHighlightingTest
Groupt multiplatform test cases in a nested class, get rid of duplicated code, rename "header" -> "common" where it relates to the common module
This commit is contained in:
+36
-66
@@ -61,80 +61,50 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
|||||||
checkHighlightingInAllFiles()
|
checkHighlightingInAllFiles()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testPlatformBasic() {
|
class MultiPlatform : AbstractMultiModuleHighlightingTest() {
|
||||||
val header = module("header")
|
override val testPath get() = super.testPath + "multiplatform/"
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
|
||||||
|
|
||||||
val jvm = module("jvm")
|
private fun doTest(vararg platforms: TargetPlatformKind<*>) {
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
val commonModule = module("common")
|
||||||
jvm.enableMultiPlatform()
|
commonModule.createFacet(TargetPlatformKind.Common)
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
for (platform in platforms) {
|
||||||
}
|
val path = when (platform) {
|
||||||
|
is TargetPlatformKind.Jvm -> "jvm"
|
||||||
|
is TargetPlatformKind.JavaScript -> "js"
|
||||||
|
else -> error("Unsupported platform: $platform")
|
||||||
|
}
|
||||||
|
val platformModule = module(path)
|
||||||
|
platformModule.createFacet(platform)
|
||||||
|
platformModule.enableMultiPlatform()
|
||||||
|
platformModule.addDependency(commonModule)
|
||||||
|
}
|
||||||
|
|
||||||
fun testPlatformClass() {
|
checkHighlightingInAllFiles()
|
||||||
val header = module("header")
|
}
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
|
||||||
|
|
||||||
val jvm = module("jvm")
|
fun testBasic() {
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||||
jvm.enableMultiPlatform()
|
}
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
fun testHeaderClass() {
|
||||||
}
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||||
|
}
|
||||||
|
|
||||||
fun testPlatformNotImplementedForBoth() {
|
fun testHeaderWithoutImplForBoth() {
|
||||||
val header = module("header")
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], TargetPlatformKind.JavaScript)
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
}
|
||||||
|
|
||||||
val jvm = module("jvm")
|
fun testHeaderPartiallyImplemented() {
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||||
jvm.enableMultiPlatform()
|
}
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
val js = module("js")
|
fun testHeaderFunctionProperty() {
|
||||||
js.createFacet(TargetPlatformKind.JavaScript)
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||||
js.enableMultiPlatform()
|
}
|
||||||
js.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
fun testSuppressHeaderWithoutImpl() {
|
||||||
}
|
doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||||
|
}
|
||||||
fun testPlatformPartiallyImplemented() {
|
|
||||||
val header = module("header")
|
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
|
||||||
|
|
||||||
val jvm = module("jvm")
|
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
|
||||||
jvm.enableMultiPlatform()
|
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testPlatformFunctionProperty() {
|
|
||||||
val header = module("header")
|
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
|
||||||
|
|
||||||
val jvm = module("jvm")
|
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
|
||||||
jvm.enableMultiPlatform()
|
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testPlatformSuppress() {
|
|
||||||
val header = module("header")
|
|
||||||
header.createFacet(TargetPlatformKind.Common)
|
|
||||||
|
|
||||||
val jvm = module("jvm")
|
|
||||||
jvm.createFacet(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
|
||||||
jvm.enableMultiPlatform()
|
|
||||||
jvm.addDependency(header)
|
|
||||||
|
|
||||||
checkHighlightingInAllFiles()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user