[K/JS] Generate tests for K2 + ES-classes compilation

This commit is contained in:
Artem Kobzar
2023-08-01 09:16:20 +00:00
committed by Space Team
parent 19653df1c6
commit 08bd0d6ce1
43 changed files with 54150 additions and 72 deletions
@@ -137,6 +137,10 @@ fun main(args: Array<String>) {
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("es6classes"))
}
testClass<AbstractFirJsES6BoxTest> {
model("box/", pattern = "^([^_](.+))\\.kt$")
}
// see todo on defining class
// testClass<AbstractFirJsTypeScriptExportTest> {
// model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
@@ -218,6 +222,22 @@ fun main(args: Array<String>) {
model("codegen/boxWasmJsInterop")
}
testClass<AbstractFirJsES6CodegenBoxTest> {
model("codegen/box", excludeDirs = jvmOnlyBoxTests)
}
testClass<AbstractFirJsES6CodegenBoxErrorTest> {
model("codegen/boxError", excludeDirs = jvmOnlyBoxTests)
}
testClass<AbstractFirJsES6CodegenInlineTest> {
model("codegen/boxInline")
}
testClass<AbstractFirJsES6CodegenWasmJsInteropTest> {
model("codegen/boxWasmJsInterop")
}
// see todo on AbstractFirJsSteppingTest
// testClass<AbstractFirJsSteppingTest> {
// model("debug/stepping")
@@ -0,0 +1,59 @@
package org.jetbrains.kotlin.js.test.fir
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.builders.*
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.frontend.fir.FirMetaInfoDiffSuppressor
import org.jetbrains.kotlin.test.runners.codegen.commonFirHandlersForCodegenTest
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
abstract class AbstractFirJsES6Test(
pathToTestDir: String = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/box/",
testGroupOutputDirPrefix: String,
) : AbstractFirJsTest(pathToTestDir, testGroupOutputDirPrefix, TargetBackend.JS_IR_ES6) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+JsEnvironmentConfigurationDirectives.ES6_MODE
}
}
}
}
open class AbstractFirJsES6BoxTest : AbstractFirJsES6Test(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/box/",
testGroupOutputDirPrefix = "firEs6Box/"
)
open class AbstractFirJsES6CodegenBoxTest : AbstractFirJsES6Test(
pathToTestDir = "compiler/testData/codegen/box/",
testGroupOutputDirPrefix = "codegen/firEs6Box/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configureFirHandlersStep {
commonFirHandlersForCodegenTest()
}
builder.useAfterAnalysisCheckers(
::FirMetaInfoDiffSuppressor
)
}
}
open class AbstractFirJsES6CodegenBoxErrorTest : AbstractFirJsES6Test(
pathToTestDir = "compiler/testData/codegen/boxError/",
testGroupOutputDirPrefix = "codegen/firEs6BoxError/"
)
open class AbstractFirJsES6CodegenInlineTest : AbstractFirJsES6Test(
pathToTestDir = "compiler/testData/codegen/boxInline/",
testGroupOutputDirPrefix = "codegen/firEs6BoxInline/"
)
open class AbstractFirJsES6CodegenWasmJsInteropTest : AbstractFirJsES6Test(
pathToTestDir = "compiler/testData/codegen/wasmJsInterop",
testGroupOutputDirPrefix = "codegen/wasmJsInteropJsEs6"
)
@@ -29,8 +29,9 @@ import java.lang.Boolean.getBoolean
open class AbstractFirJsTest(
pathToTestDir: String = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/box/",
testGroupOutputDirPrefix: String,
targetBackend: TargetBackend = TargetBackend.JS_IR
) : AbstractJsBlackBoxCodegenTestBase<FirOutputArtifact, IrBackendInput, BinaryArtifacts.KLib>(
FrontendKinds.FIR, TargetBackend.JS_IR, pathToTestDir, testGroupOutputDirPrefix, skipMinification = true
FrontendKinds.FIR, targetBackend, pathToTestDir, testGroupOutputDirPrefix, skipMinification = true
) {
override val frontendFacade: Constructor<FrontendFacade<FirOutputArtifact>>
get() = ::FirFrontendFacade