[Wasm] PL tests implementation for Wasm target
Fixed #KT-58088
This commit is contained in:
committed by
Space Team
parent
6b66195afc
commit
7c16528560
@@ -27,6 +27,7 @@ private typealias Block<T> = () -> T
|
||||
data class TestMode(
|
||||
val isJs: Boolean = false,
|
||||
val isNative: Boolean = false,
|
||||
val isWasm: Boolean = false,
|
||||
val staticCache: Scope = Scope.NOWHERE,
|
||||
val lazyIr: Scope = Scope.NOWHERE
|
||||
) {
|
||||
@@ -39,7 +40,7 @@ data class TestMode(
|
||||
}
|
||||
|
||||
init {
|
||||
check(isJs xor isNative)
|
||||
check(isJs xor isNative xor isWasm)
|
||||
check(isNative || staticCache.notUsed)
|
||||
check(isNative || lazyIr.notUsed)
|
||||
}
|
||||
|
||||
@@ -159,10 +159,12 @@ fun box() = abiTest {
|
||||
expectFailure(linkage("Function 'getAnnotationClassWithParameterOfParameterThatDisappearsInline' can not be called: Function uses unlinked class symbol '/AnnotationClassThatDisappears' (via annotation class 'AnnotationClassWithParameterOfParameterThatDisappears')")) { getAnnotationClassWithParameterOfParameterThatDisappearsInline() }
|
||||
expectFailure(linkage("Constructor 'AnnotationClassThatDisappears.<init>' can not be called: No constructor found for symbol '/AnnotationClassThatDisappears.<init>'")) { getAnnotationClassWithParameterThatDisappearsAsAny() }
|
||||
expectFailure(linkage("Constructor 'AnnotationClassThatDisappears.<init>' can not be called: No constructor found for symbol '/AnnotationClassThatDisappears.<init>'")) { getAnnotationClassWithParameterThatDisappearsAsAnyInline() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=129, xs=Banana)") { getAnnotationClassWithRenamedParameters().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=130, xs=Pear)") { getAnnotationClassWithRenamedParametersInline().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=131, xs=Orange)") { getAnnotationClassWithRenamedParametersAsAny().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=132, xs=Peach)") { getAnnotationClassWithRenamedParametersAsAnyInline().toString() }
|
||||
if (!testMode.isWasm) { //toString for annotation classes are not supported KT-66385
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=129, xs=Banana)") { getAnnotationClassWithRenamedParameters().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=130, xs=Pear)") { getAnnotationClassWithRenamedParametersInline().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=131, xs=Orange)") { getAnnotationClassWithRenamedParametersAsAny().toString() }
|
||||
expectSuccess("@AnnotationClassWithRenamedParameters(xi=132, xs=Peach)") { getAnnotationClassWithRenamedParametersAsAnyInline().toString() }
|
||||
}
|
||||
expectFailure(linkage("Constructor 'AnnotationClassWithReorderedParameters.<init>' can not be called: No constructor found for symbol '/AnnotationClassWithReorderedParameters.<init>'")) { getAnnotationClassWithReorderedParameters() }
|
||||
expectFailure(linkage("Constructor 'AnnotationClassWithReorderedParameters.<init>' can not be called: No constructor found for symbol '/AnnotationClassWithReorderedParameters.<init>'")) { getAnnotationClassWithReorderedParametersInline() }
|
||||
expectFailure(linkage("Constructor 'AnnotationClassWithReorderedParameters.<init>' can not be called: No constructor found for symbol '/AnnotationClassWithReorderedParameters.<init>'")) { getAnnotationClassWithReorderedParametersAsAny() }
|
||||
|
||||
@@ -6,13 +6,6 @@ external class ExternalClassInheritedFromAbstractExternalClass : AbstractExterna
|
||||
|
||||
fun ExternalClassInheritedFromAbstractExternalClass.callRemovedFunction() = removedFunction()
|
||||
|
||||
class RegularClassInheritedFromAbstractExternalClass : AbstractExternalClass() {
|
||||
override fun abstractFunction() = "RegularClassInheritedFromAbstractExternalClass.abstractFunction"
|
||||
override fun removedAbstractFunction() = "RegularClassInheritedFromAbstractExternalClass.removedAbstractFunction"
|
||||
}
|
||||
|
||||
fun RegularClassInheritedFromAbstractExternalClass.callRemovedFunction() = removedFunction()
|
||||
|
||||
open external class OpenExternalClass {
|
||||
fun function(): String
|
||||
}
|
||||
@@ -24,15 +17,4 @@ external interface ExternalInterfaceInheritedFromOpenExternalClass : OpenExterna
|
||||
|
||||
external class ExternalClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass : ExternalInterfaceInheritedFromOpenExternalClass {
|
||||
override fun abstractFunction(): String
|
||||
}
|
||||
|
||||
class RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass :
|
||||
ExternalInterfaceInheritedFromOpenExternalClass,
|
||||
/* Note: Have to explicitly inherit from 'OpenExternalClass' becase otherwise JS codegen sees that
|
||||
* class 'RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass' is inherited only from
|
||||
* interface 'ExternalInterfaceInheritedFromOpenExternalClass' and does not figure out that a bridge has to be
|
||||
* generated for function 'function' inherited from 'OpenExternalClass'.
|
||||
*/
|
||||
OpenExternalClass() {
|
||||
override fun abstractFunction(): String = "RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass.abstractFunction"
|
||||
}
|
||||
}
|
||||
@@ -3,28 +3,23 @@ import abitestutils.TestBuilder
|
||||
|
||||
fun box() = abiTest {
|
||||
val ecifaec = ExternalClassInheritedFromAbstractExternalClass()
|
||||
val rcifaec = RegularClassInheritedFromAbstractExternalClass()
|
||||
val ecifeiifoec = ExternalClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass()
|
||||
val rcifeiifoec = RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass()
|
||||
|
||||
expectSuccess("ExternalClassInheritedFromAbstractExternalClass.abstractFunction") { ecifaec.abstractFunction() }
|
||||
expectSuccess("ExternalClassInheritedFromAbstractExternalClass.removedAbstractFunction") { ecifaec.removedAbstractFunction() }
|
||||
expectRuntimeFailure("Calling abstract function AbstractExternalClass.addedAbstractFunction") { ecifaec.addedAbstractFunction() }
|
||||
|
||||
val expectedExceptionMessage = when (testMode.isWasm) {
|
||||
true -> "Exception was thrown while running JavaScript code"
|
||||
else -> "Calling abstract function AbstractExternalClass.addedAbstractFunction"
|
||||
}
|
||||
expectRuntimeFailure(expectedExceptionMessage) { ecifaec.addedAbstractFunction() }
|
||||
|
||||
expectSuccess("AbstractExternalClass.function") { ecifaec.function() }
|
||||
expectFailure(linkage("Function 'removedFunction' can not be called: No function found for symbol '/ExternalClassInheritedFromAbstractExternalClass.removedFunction'")) { ecifaec.callRemovedFunction() }
|
||||
expectSuccess("AbstractExternalClass.addedFunction") { ecifaec.addedFunction() }
|
||||
|
||||
expectSuccess("RegularClassInheritedFromAbstractExternalClass.abstractFunction") { rcifaec.abstractFunction() }
|
||||
expectSuccess("RegularClassInheritedFromAbstractExternalClass.removedAbstractFunction") { rcifaec.removedAbstractFunction() }
|
||||
expectFailure(nonImplementedCallable("function 'addedAbstractFunction'", "class 'RegularClassInheritedFromAbstractExternalClass'")) { rcifaec.addedAbstractFunction() }
|
||||
expectSuccess("AbstractExternalClass.function") { rcifaec.function() }
|
||||
expectFailure(linkage("Function 'removedFunction' can not be called: No function found for symbol '/RegularClassInheritedFromAbstractExternalClass.removedFunction'")) { rcifaec.callRemovedFunction() }
|
||||
expectSuccess("AbstractExternalClass.addedFunction") { rcifaec.addedFunction() }
|
||||
|
||||
expectSuccess("OpenExternalClass.function") { ecifeiifoec.function() }
|
||||
expectSuccess("ExternalClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass.abstractFunction") { ecifeiifoec.abstractFunction() }
|
||||
expectSuccess("OpenExternalClass.function") { rcifeiifoec.function() }
|
||||
expectSuccess("RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass.abstractFunction") { rcifeiifoec.abstractFunction() }
|
||||
}
|
||||
|
||||
private fun TestBuilder.expectRuntimeFailure(errorMessage: String, block: () -> Any) =
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
function AbstractExternalClass() {}
|
||||
AbstractExternalClass.prototype.abstractFunction = function() {
|
||||
throw new Error("Calling abstract function AbstractExternalClass.abstractFunction");
|
||||
}
|
||||
AbstractExternalClass.prototype.removedAbstractFunction = function() {
|
||||
throw new Error("Calling abstract function AbstractExternalClass.removedAbstractFunction");
|
||||
}
|
||||
// AbstractExternalClass.prototype.addedAbstractFunction = function() {
|
||||
// throw new Error("Calling abstract function AbstractExternalClass.addedAbstractFunction");
|
||||
// }
|
||||
AbstractExternalClass.prototype.function = function() {
|
||||
return "AbstractExternalClass.function";
|
||||
}
|
||||
AbstractExternalClass.prototype.removedFunction = function() {
|
||||
return "AbstractExternalClass.removedFunction";
|
||||
}
|
||||
// AbstractExternalClass.prototype.addedFunction = function() {
|
||||
// return "AbstractExternalClass.addedFunction";
|
||||
// }
|
||||
@@ -0,0 +1,19 @@
|
||||
function AbstractExternalClass() {}
|
||||
AbstractExternalClass.prototype.abstractFunction = function() {
|
||||
throw new Error("Calling abstract function AbstractExternalClass.abstractFunction");
|
||||
}
|
||||
// AbstractExternalClass.prototype.removedAbstractFunction = function() {
|
||||
// throw new Error("Calling abstract function AbstractExternalClass.removedAbstractFunction");
|
||||
// }
|
||||
AbstractExternalClass.prototype.addedAbstractFunction = function() {
|
||||
throw new Error("Calling abstract function AbstractExternalClass.addedAbstractFunction");
|
||||
}
|
||||
AbstractExternalClass.prototype.function = function() {
|
||||
return "AbstractExternalClass.function";
|
||||
}
|
||||
// AbstractExternalClass.prototype.removedFunction = function() {
|
||||
// return "AbstractExternalClass.removedFunction";
|
||||
// }
|
||||
AbstractExternalClass.prototype.addedFunction = function() {
|
||||
return "AbstractExternalClass.addedFunction";
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
abstract external class AbstractExternalClass {
|
||||
abstract fun abstractFunction(): String
|
||||
abstract fun removedAbstractFunction(): String
|
||||
// abstract fun addedAbstractFunction(): String
|
||||
|
||||
fun function(): String
|
||||
fun removedFunction(): String
|
||||
// fun addedFunction(): String
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
abstract external class AbstractExternalClass {
|
||||
abstract fun abstractFunction(): String
|
||||
// abstract fun removedAbstractFunction(): String
|
||||
abstract fun addedAbstractFunction(): String
|
||||
|
||||
fun function(): String
|
||||
// fun removedFunction(): String
|
||||
fun addedFunction(): String
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib
|
||||
STEP 1:
|
||||
dependencies: stdlib
|
||||
modifications:
|
||||
U : l1.kt.1 -> l1.kt
|
||||
U : l1.js.1 -> l1.js
|
||||
@@ -0,0 +1,10 @@
|
||||
function OpenExternalClass() {}
|
||||
OpenExternalClass.prototype.function = function() {
|
||||
return "OpenExternalClass.function"
|
||||
}
|
||||
|
||||
function ExternalInterfaceInheritedFromOpenExternalClass() {}
|
||||
ExternalInterfaceInheritedFromOpenExternalClass.prototype = Object.create(OpenExternalClass.prototype);
|
||||
ExternalInterfaceInheritedFromOpenExternalClass.prototype.abstractFunction = function() {
|
||||
throw new Error("Calling abstract function ExternalInterfaceInheritedFromOpenExternalClass.abstractFunction");
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
class RegularClassInheritedFromAbstractExternalClass : AbstractExternalClass() {
|
||||
override fun abstractFunction() = "RegularClassInheritedFromAbstractExternalClass.abstractFunction"
|
||||
override fun removedAbstractFunction() = "RegularClassInheritedFromAbstractExternalClass.removedAbstractFunction"
|
||||
}
|
||||
|
||||
fun RegularClassInheritedFromAbstractExternalClass.callRemovedFunction() = removedFunction()
|
||||
|
||||
open external class OpenExternalClass {
|
||||
fun function(): String
|
||||
}
|
||||
|
||||
@Suppress("INTERFACE_WITH_SUPERCLASS")
|
||||
external interface ExternalInterfaceInheritedFromOpenExternalClass : OpenExternalClass {
|
||||
fun abstractFunction(): String
|
||||
}
|
||||
|
||||
class RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass :
|
||||
ExternalInterfaceInheritedFromOpenExternalClass,
|
||||
/* Note: Have to explicitly inherit from 'OpenExternalClass' becase otherwise JS codegen sees that
|
||||
* class 'RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass' is inherited only from
|
||||
* interface 'ExternalInterfaceInheritedFromOpenExternalClass' and does not figure out that a bridge has to be
|
||||
* generated for function 'function' inherited from 'OpenExternalClass'.
|
||||
*/
|
||||
OpenExternalClass() {
|
||||
override fun abstractFunction(): String = "RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass.abstractFunction"
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib, lib1
|
||||
@@ -0,0 +1,20 @@
|
||||
import abitestutils.abiTest
|
||||
import abitestutils.TestBuilder
|
||||
|
||||
fun box() = abiTest {
|
||||
val rcifaec = RegularClassInheritedFromAbstractExternalClass()
|
||||
val rcifeiifoec = RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass()
|
||||
|
||||
expectSuccess("RegularClassInheritedFromAbstractExternalClass.abstractFunction") { rcifaec.abstractFunction() }
|
||||
expectSuccess("RegularClassInheritedFromAbstractExternalClass.removedAbstractFunction") { rcifaec.removedAbstractFunction() }
|
||||
expectFailure(nonImplementedCallable("function 'addedAbstractFunction'", "class 'RegularClassInheritedFromAbstractExternalClass'")) { rcifaec.addedAbstractFunction() }
|
||||
expectSuccess("AbstractExternalClass.function") { rcifaec.function() }
|
||||
expectFailure(linkage("Function 'removedFunction' can not be called: No function found for symbol '/RegularClassInheritedFromAbstractExternalClass.removedFunction'")) { rcifaec.callRemovedFunction() }
|
||||
expectSuccess("AbstractExternalClass.addedFunction") { rcifaec.addedFunction() }
|
||||
|
||||
expectSuccess("OpenExternalClass.function") { rcifeiifoec.function() }
|
||||
expectSuccess("RegularClassInheritedFromExternalInterfaceInheritedFromOpenExternalClass.abstractFunction") { rcifeiifoec.abstractFunction() }
|
||||
}
|
||||
|
||||
private fun TestBuilder.expectRuntimeFailure(errorMessage: String, block: () -> Any) =
|
||||
expectFailure(custom { throwable -> throwable !is Exception && throwable.message == errorMessage }) { block() }
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
STEP 1:
|
||||
dependencies: stdlib, lib1, lib2
|
||||
@@ -0,0 +1,7 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
libs: lib1, lib2
|
||||
|
||||
STEP 1:
|
||||
libs: lib1, main
|
||||
Generated
+6
@@ -66,6 +66,12 @@ public class FirJsPartialLinkageNoICTestCaseGenerated extends AbstractFirJsParti
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
Generated
+6
@@ -66,6 +66,12 @@ public class JsPartialLinkageNoICES6TestCaseGenerated extends AbstractJsPartialL
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
Generated
+6
@@ -66,6 +66,12 @@ public class JsPartialLinkageNoICTestCaseGenerated extends AbstractJsPartialLink
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
Generated
+6
@@ -66,6 +66,12 @@ public class JsPartialLinkageWithICTestCaseGenerated extends AbstractJsPartialLi
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
+6
@@ -69,6 +69,12 @@ public class FirNativePartialLinkageTestGenerated extends AbstractNativePartialL
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
+6
@@ -65,6 +65,12 @@ public class NativePartialLinkageTestGenerated extends AbstractNativePartialLink
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ abstract class AbstractNativePartialLinkageTest : AbstractNativeSimpleTest() {
|
||||
override fun onNonEmptyBuildDirectory(directory: File) = backupDirectoryContents(directory)
|
||||
|
||||
override fun isIgnoredTest(projectInfo: ProjectInfo) =
|
||||
super.isIgnoredTest(projectInfo) || projectInfo.name == "externalDeclarations"
|
||||
super.isIgnoredTest(projectInfo) || projectInfo.name == "externalDeclarations" || projectInfo.name == "externalDeclarationsKJS"
|
||||
|
||||
override fun onIgnoredTest() = throw TestAbortedException()
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
||||
import org.jetbrains.kotlin.wasm.test.AbstractWasmPartialLinkageWithICTestCase
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.wasm.test.*
|
||||
import org.jetbrains.kotlin.wasm.test.diagnostics.AbstractDiagnosticsWasmTest
|
||||
import org.jetbrains.kotlin.wasm.test.diagnostics.AbstractDiagnosticsFirWasmTest
|
||||
@@ -29,6 +31,26 @@ fun main(args: Array<String>) {
|
||||
"crossModuleRef", "crossModuleRefPerFile", "crossModuleRefPerModule"
|
||||
)
|
||||
|
||||
generateTestGroupSuiteWithJUnit5(args) {
|
||||
testGroup("wasm/wasm.tests/tests-gen", "compiler/testData") {
|
||||
testClass<AbstractWasmPartialLinkageNoICTestCase> {
|
||||
model("klib/partial-linkage/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.WASM, recursive = false)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("wasm/wasm.tests/tests-gen", "compiler/testData") {
|
||||
testClass<AbstractWasmPartialLinkageWithICTestCase> {
|
||||
model("klib/partial-linkage/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.WASM, recursive = false)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("wasm/wasm.tests/tests-gen", "compiler/testData") {
|
||||
testClass<AbstractFirWasmPartialLinkageNoICTestCase> {
|
||||
model("klib/partial-linkage/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.WASM, recursive = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateTestGroupSuiteWithJUnit5(args) {
|
||||
testGroup("wasm/wasm.tests/tests-gen", "compiler/testData") {
|
||||
testClass<AbstractDiagnosticsWasmTest> {
|
||||
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.wasm.test
|
||||
|
||||
import com.intellij.testFramework.TestDataFile
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.js.K2JsIrCompiler
|
||||
import org.jetbrains.kotlin.codegen.ProjectInfo
|
||||
import org.jetbrains.kotlin.klib.PartialLinkageTestUtils
|
||||
import org.jetbrains.kotlin.klib.PartialLinkageTestUtils.Dependencies
|
||||
import org.jetbrains.kotlin.klib.PartialLinkageTestUtils.Dependency
|
||||
import org.jetbrains.kotlin.klib.PartialLinkageTestUtils.MAIN_MODULE_NAME
|
||||
import org.jetbrains.kotlin.klib.PartialLinkageTestUtils.ModuleBuildDirs
|
||||
import org.jetbrains.kotlin.wasm.test.tools.WasmVM
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.PrintStream
|
||||
import kotlin.io.path.createTempDirectory
|
||||
|
||||
abstract class AbstractWasmPartialLinkageNoICTestCase : AbstractWasmPartialLinkageTestCase(CompilerType.K1_NO_IC)
|
||||
abstract class AbstractWasmPartialLinkageWithICTestCase : AbstractWasmPartialLinkageTestCase(CompilerType.K1_WITH_IC)
|
||||
abstract class AbstractFirWasmPartialLinkageNoICTestCase : AbstractWasmPartialLinkageTestCase(CompilerType.K2_NO_IC)
|
||||
|
||||
abstract class AbstractWasmPartialLinkageTestCase(private val compilerType: CompilerType) {
|
||||
enum class CompilerType(val useFir: Boolean, val useIc: Boolean) {
|
||||
K1_NO_IC(useFir = false, useIc = false),
|
||||
K1_WITH_IC(useFir = false, useIc = true),
|
||||
K2_NO_IC(useFir = true, useIc = false)
|
||||
}
|
||||
|
||||
private val buildDir: File = createTempDirectory().toFile().also { it.mkdirs() }
|
||||
|
||||
@AfterEach
|
||||
fun clearArtifacts() {
|
||||
buildDir.deleteRecursively()
|
||||
}
|
||||
|
||||
private inner class WasmTestConfiguration(testPath: String) : PartialLinkageTestUtils.TestConfiguration {
|
||||
override val testDir: File = File(testPath).absoluteFile
|
||||
override val buildDir: File get() = this@AbstractWasmPartialLinkageTestCase.buildDir
|
||||
override val stdlibFile: File get() = File("libraries/stdlib/build/classes/kotlin/wasmJs/main").absoluteFile
|
||||
override val testModeConstructorParameters = mapOf("isWasm" to "true")
|
||||
|
||||
override fun customizeModuleSources(moduleName: String, moduleSourceDir: File) {
|
||||
if (moduleName == MAIN_MODULE_NAME) {
|
||||
File(moduleSourceDir, "runner.kt")
|
||||
.writeText("@kotlin.wasm.WasmExport fun runBoxTest() = println($BOX_FUN_FQN())")
|
||||
}
|
||||
}
|
||||
|
||||
override fun buildKlib(
|
||||
moduleName: String,
|
||||
buildDirs: ModuleBuildDirs,
|
||||
dependencies: Dependencies,
|
||||
klibFile: File,
|
||||
) = this@AbstractWasmPartialLinkageTestCase.buildKlib(moduleName, buildDirs, dependencies, klibFile)
|
||||
|
||||
override fun buildBinaryAndRun(mainModule: Dependency, otherDependencies: Dependencies) =
|
||||
this@AbstractWasmPartialLinkageTestCase.buildBinaryAndRun(mainModule, otherDependencies)
|
||||
|
||||
override fun onNonEmptyBuildDirectory(directory: File) {
|
||||
directory.listFiles()?.forEach(File::deleteRecursively)
|
||||
}
|
||||
|
||||
override fun isIgnoredTest(projectInfo: ProjectInfo): Boolean =
|
||||
super.isIgnoredTest(projectInfo) || projectInfo.name == "externalDeclarationsKJS"
|
||||
|
||||
override fun onIgnoredTest() {
|
||||
/* Do nothing specific. JUnit 3 does not support programmatic tests muting. */
|
||||
}
|
||||
}
|
||||
|
||||
// The entry point to generated test classes.
|
||||
fun runTest(@TestDataFile testPath: String) = PartialLinkageTestUtils.runTest(WasmTestConfiguration(testPath))
|
||||
|
||||
fun buildKlib(moduleName: String, buildDirs: ModuleBuildDirs, dependencies: Dependencies, klibFile: File) {
|
||||
val kotlinSourceFilePaths = mutableListOf<String>()
|
||||
|
||||
buildDirs.sourceDir.walkTopDown().forEach { sourceFile ->
|
||||
if (sourceFile.isFile) when (sourceFile.extension) {
|
||||
"kt" -> kotlinSourceFilePaths += sourceFile.absolutePath
|
||||
"js" -> {
|
||||
// This is needed to preserve *.js files from test data which are required for tests with `external` declarations:
|
||||
sourceFile.copyTo(buildDirs.outputDir.resolve(sourceFile.relativeTo(buildDirs.sourceDir)), overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build KLIB:
|
||||
runCompilerViaCLI(
|
||||
listOf(
|
||||
"-Xir-produce-klib-file",
|
||||
"-ir-output-dir", klibFile.parentFile.absolutePath,
|
||||
"-ir-output-name", moduleName,
|
||||
// Halt on any unexpected warning.
|
||||
"-Werror",
|
||||
// Tests suppress the INVISIBLE_REFERENCE check.
|
||||
// However, JS doesn't produce the INVISIBLE_REFERENCE error;
|
||||
// As result, it triggers a suppression error warning about the redundant suppression.
|
||||
// This flag is used to disable the warning.
|
||||
"-Xdont-warn-on-error-suppression",
|
||||
"-Xwasm"
|
||||
),
|
||||
dependencies.toCompilerArgs(),
|
||||
listOf(
|
||||
"-language-version", "2.0",
|
||||
// Don't fail on language version warnings.
|
||||
"-Xsuppress-version-warnings"
|
||||
).takeIf { compilerType.useFir },
|
||||
kotlinSourceFilePaths
|
||||
)
|
||||
}
|
||||
|
||||
private fun buildBinaryAndRun(mainModule: Dependency, otherDependencies: Dependencies) {
|
||||
val binariesDir: File = File(buildDir, BIN_DIR_NAME).also { it.mkdirs() }
|
||||
|
||||
runCompilerViaCLI(
|
||||
listOf(
|
||||
"-Xir-produce-js",
|
||||
"-Xir-per-module",
|
||||
"-module-kind", "plain",
|
||||
"-Xinclude=${mainModule.libraryFile.absolutePath}",
|
||||
"-ir-output-dir", binariesDir.absolutePath,
|
||||
"-ir-output-name", MAIN_MODULE_NAME,
|
||||
// IMPORTANT: Omitting PL arguments here. The default PL mode should be in effect.
|
||||
// "-Xpartial-linkage=enable", "-Xpartial-linkage-loglevel=INFO",
|
||||
"-Werror",
|
||||
"-Xwasm",
|
||||
),
|
||||
listOf(
|
||||
"-Xcache-directory=${buildDir.resolve("libs-cache").absolutePath}",
|
||||
).takeIf { compilerType.useIc },
|
||||
otherDependencies.toCompilerArgs(),
|
||||
)
|
||||
|
||||
val mainModuleMjsName = "$MAIN_MODULE_NAME.mjs"
|
||||
val resultMjs = File(binariesDir, mainModuleMjsName)
|
||||
if (!resultMjs.exists()) error("Produced binary not found")
|
||||
|
||||
val runnerFileName = "runner.mjs"
|
||||
File(binariesDir, runnerFileName).writeText(
|
||||
"""
|
||||
const { runBoxTest } = await import('./$mainModuleMjsName');
|
||||
runBoxTest();
|
||||
""",
|
||||
)
|
||||
|
||||
val additionalJsFiles = mutableListOf<File>()
|
||||
additionalJsFiles.addAll(getAdditionalJsFiles(mainModule))
|
||||
otherDependencies.regularDependencies.flatMapTo(additionalJsFiles) { getAdditionalJsFiles(it) }
|
||||
otherDependencies.friendDependencies.flatMapTo(additionalJsFiles) { getAdditionalJsFiles(it) }
|
||||
|
||||
val result = WasmVM.V8.run(runnerFileName, additionalJsFiles.map { it.absolutePath }, binariesDir)
|
||||
check("OK" == result.trim())
|
||||
}
|
||||
|
||||
private fun Dependencies.toCompilerArgs(): List<String> = buildList {
|
||||
if (regularDependencies.isNotEmpty()) {
|
||||
this += "-libraries"
|
||||
this += regularDependencies.joinToString(File.pathSeparator) { it.libraryFile.absolutePath }
|
||||
}
|
||||
if (friendDependencies.isNotEmpty()) {
|
||||
this += "-Xfriend-modules=${friendDependencies.joinToString(File.pathSeparator) { it.libraryFile.absolutePath }}"
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAdditionalJsFiles(dependency: Dependency): List<File> {
|
||||
val outputDirectory = dependency.libraryFile.let {
|
||||
it.takeIf { it.isDirectory } ?: it.parentFile
|
||||
}
|
||||
return outputDirectory.listFiles()!!.filter { it.extension == "js" }
|
||||
}
|
||||
|
||||
private fun runCompilerViaCLI(vararg compilerArgs: List<String?>?) {
|
||||
val allCompilerArgs = compilerArgs.flatMap { args -> args.orEmpty().filterNotNull() }.toTypedArray()
|
||||
|
||||
val compilerXmlOutput = ByteArrayOutputStream()
|
||||
val exitCode = PrintStream(compilerXmlOutput).use { printStream ->
|
||||
K2JsIrCompiler().execFullPathsInMessages(printStream, allCompilerArgs)
|
||||
}
|
||||
|
||||
if (exitCode != ExitCode.OK)
|
||||
throw AssertionError(
|
||||
buildString {
|
||||
appendLine("Compiler failure.")
|
||||
appendLine("Exit code = $exitCode.")
|
||||
appendLine("Compiler messages:")
|
||||
appendLine("==========")
|
||||
appendLine(compilerXmlOutput.toString(Charsets.UTF_8.name()))
|
||||
appendLine("==========")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val BIN_DIR_NAME = "_bins_wasm"
|
||||
private const val BOX_FUN_FQN = "box"
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/klib/partial-linkage")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirWasmPartialLinkageNoICTestCaseGenerated extends AbstractFirWasmPartialLinkageNoICTestCase {
|
||||
@Test
|
||||
@TestMetadata("addEnumEntry")
|
||||
public void testAddEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("addSealedSubclass")
|
||||
public void testAddSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInPartial_linkage() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klib/partial-linkage"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.WASM, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeClassVisibility")
|
||||
public void testChangeClassVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeClassVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeFunctionVisibility")
|
||||
public void testChangeFunctionVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeFunctionVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changePropertyVisibility")
|
||||
public void testChangePropertyVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changePropertyVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classTransformations")
|
||||
public void testClassTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/classTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarations")
|
||||
public void testExternalDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/functionTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceIssues")
|
||||
public void testInheritanceIssues() {
|
||||
runTest("compiler/testData/klib/partial-linkage/inheritanceIssues/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noNonImplementedCallableFalsePositives")
|
||||
public void testNoNonImplementedCallableFalsePositives() {
|
||||
runTest("compiler/testData/klib/partial-linkage/noNonImplementedCallableFalsePositives/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonAbstractCallableBecomesAbstract")
|
||||
public void testNonAbstractCallableBecomesAbstract() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonAbstractCallableBecomesAbstract/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonExhaustivenessOfWhenClause")
|
||||
public void testNonExhaustivenessOfWhenClause() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonExhaustivenessOfWhenClause/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTransformations")
|
||||
public void testPropertyTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/propertyTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referencingUnusableDeclarations")
|
||||
public void testReferencingUnusableDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAbstractCallableFromAbstractClassOrInterface")
|
||||
public void testRemoveAbstractCallableFromAbstractClassOrInterface() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeAbstractCallableFromAbstractClassOrInterface/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeCallable")
|
||||
public void testRemoveCallable() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeCallable/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeClass")
|
||||
public void testRemoveClass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeEnumEntry")
|
||||
public void testRemoveEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeSealedSubclass")
|
||||
public void testRemoveSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replaceCallableReturnType")
|
||||
public void testReplaceCallableReturnType() {
|
||||
runTest("compiler/testData/klib/partial-linkage/replaceCallableReturnType/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalInheritedImplementations")
|
||||
public void testSeveralInheritedImplementations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/severalInheritedImplementations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasChanges")
|
||||
public void testTypeAliasChanges() {
|
||||
runTest("compiler/testData/klib/partial-linkage/typeAliasChanges/");
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/klib/partial-linkage")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class WasmPartialLinkageNoICTestCaseGenerated extends AbstractWasmPartialLinkageNoICTestCase {
|
||||
@Test
|
||||
@TestMetadata("addEnumEntry")
|
||||
public void testAddEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("addSealedSubclass")
|
||||
public void testAddSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInPartial_linkage() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klib/partial-linkage"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.WASM, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeClassVisibility")
|
||||
public void testChangeClassVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeClassVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeFunctionVisibility")
|
||||
public void testChangeFunctionVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeFunctionVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changePropertyVisibility")
|
||||
public void testChangePropertyVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changePropertyVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classTransformations")
|
||||
public void testClassTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/classTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarations")
|
||||
public void testExternalDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/functionTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceIssues")
|
||||
public void testInheritanceIssues() {
|
||||
runTest("compiler/testData/klib/partial-linkage/inheritanceIssues/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noNonImplementedCallableFalsePositives")
|
||||
public void testNoNonImplementedCallableFalsePositives() {
|
||||
runTest("compiler/testData/klib/partial-linkage/noNonImplementedCallableFalsePositives/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonAbstractCallableBecomesAbstract")
|
||||
public void testNonAbstractCallableBecomesAbstract() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonAbstractCallableBecomesAbstract/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonExhaustivenessOfWhenClause")
|
||||
public void testNonExhaustivenessOfWhenClause() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonExhaustivenessOfWhenClause/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTransformations")
|
||||
public void testPropertyTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/propertyTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referencingUnusableDeclarations")
|
||||
public void testReferencingUnusableDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAbstractCallableFromAbstractClassOrInterface")
|
||||
public void testRemoveAbstractCallableFromAbstractClassOrInterface() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeAbstractCallableFromAbstractClassOrInterface/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeCallable")
|
||||
public void testRemoveCallable() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeCallable/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeClass")
|
||||
public void testRemoveClass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeEnumEntry")
|
||||
public void testRemoveEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeSealedSubclass")
|
||||
public void testRemoveSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replaceCallableReturnType")
|
||||
public void testReplaceCallableReturnType() {
|
||||
runTest("compiler/testData/klib/partial-linkage/replaceCallableReturnType/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalInheritedImplementations")
|
||||
public void testSeveralInheritedImplementations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/severalInheritedImplementations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasChanges")
|
||||
public void testTypeAliasChanges() {
|
||||
runTest("compiler/testData/klib/partial-linkage/typeAliasChanges/");
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/klib/partial-linkage")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class WasmPartialLinkageWithICTestCaseGenerated extends AbstractWasmPartialLinkageWithICTestCase {
|
||||
@Test
|
||||
@TestMetadata("addEnumEntry")
|
||||
public void testAddEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("addSealedSubclass")
|
||||
public void testAddSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/addSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInPartial_linkage() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klib/partial-linkage"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.WASM, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeClassVisibility")
|
||||
public void testChangeClassVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeClassVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeFunctionVisibility")
|
||||
public void testChangeFunctionVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changeFunctionVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changePropertyVisibility")
|
||||
public void testChangePropertyVisibility() {
|
||||
runTest("compiler/testData/klib/partial-linkage/changePropertyVisibility/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classTransformations")
|
||||
public void testClassTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/classTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarations")
|
||||
public void testExternalDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("externalDeclarationsKJS")
|
||||
public void testExternalDeclarationsKJS() {
|
||||
runTest("compiler/testData/klib/partial-linkage/externalDeclarationsKJS/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionTransformations")
|
||||
public void testFunctionTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/functionTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceIssues")
|
||||
public void testInheritanceIssues() {
|
||||
runTest("compiler/testData/klib/partial-linkage/inheritanceIssues/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noNonImplementedCallableFalsePositives")
|
||||
public void testNoNonImplementedCallableFalsePositives() {
|
||||
runTest("compiler/testData/klib/partial-linkage/noNonImplementedCallableFalsePositives/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonAbstractCallableBecomesAbstract")
|
||||
public void testNonAbstractCallableBecomesAbstract() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonAbstractCallableBecomesAbstract/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonExhaustivenessOfWhenClause")
|
||||
public void testNonExhaustivenessOfWhenClause() {
|
||||
runTest("compiler/testData/klib/partial-linkage/nonExhaustivenessOfWhenClause/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTransformations")
|
||||
public void testPropertyTransformations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/propertyTransformations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referencingUnusableDeclarations")
|
||||
public void testReferencingUnusableDeclarations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/referencingUnusableDeclarations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAbstractCallableFromAbstractClassOrInterface")
|
||||
public void testRemoveAbstractCallableFromAbstractClassOrInterface() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeAbstractCallableFromAbstractClassOrInterface/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeCallable")
|
||||
public void testRemoveCallable() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeCallable/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeClass")
|
||||
public void testRemoveClass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeEnumEntry")
|
||||
public void testRemoveEnumEntry() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeSealedSubclass")
|
||||
public void testRemoveSealedSubclass() {
|
||||
runTest("compiler/testData/klib/partial-linkage/removeSealedSubclass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replaceCallableReturnType")
|
||||
public void testReplaceCallableReturnType() {
|
||||
runTest("compiler/testData/klib/partial-linkage/replaceCallableReturnType/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalInheritedImplementations")
|
||||
public void testSeveralInheritedImplementations() {
|
||||
runTest("compiler/testData/klib/partial-linkage/severalInheritedImplementations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasChanges")
|
||||
public void testTypeAliasChanges() {
|
||||
runTest("compiler/testData/klib/partial-linkage/typeAliasChanges/");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user