[JS FIR Tests] Add source map smoke test for FIR

^KT-64450 Fixed
This commit is contained in:
Alexander Korepanov
2024-01-16 11:59:35 +01:00
committed by Space Team
parent 6884266328
commit b672e5c131
4 changed files with 72 additions and 1 deletions
@@ -171,6 +171,10 @@ fun main(args: Array<String>) {
testClass<AbstractFirJsLineNumberTest> {
model("lineNumbers/")
}
testClass<AbstractFirSourceMapGenerationSmokeTest> {
model("sourcemap/")
}
}
testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.js.test.converters.incremental.RecompileModuleJsIrBa
import org.jetbrains.kotlin.js.test.handlers.JsDebugRunner
import org.jetbrains.kotlin.js.test.handlers.JsIrRecompiledArtifactsIdentityHandler
import org.jetbrains.kotlin.js.test.handlers.createFirJsLineNumberHandler
import org.jetbrains.kotlin.js.test.ir.AbstractJsIrTest
import org.jetbrains.kotlin.parsing.parseBoolean
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.FirParser
@@ -163,6 +164,21 @@ open class AbstractFirJsLineNumberTest : AbstractFirJsTest(
}
}
open class AbstractFirSourceMapGenerationSmokeTest : AbstractFirJsTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/sourcemap/",
testGroupOutputDirPrefix = "firSourcemap/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+JsEnvironmentConfigurationDirectives.GENERATE_SOURCE_MAP
-JsEnvironmentConfigurationDirectives.GENERATE_NODE_JS_RUNNER
}
}
}
}
open class AbstractFirJsSteppingTest : AbstractFirJsTest(
pathToTestDir = "compiler/testData/debug/stepping/",
testGroupOutputDirPrefix = "debug/firStepping/"
@@ -154,7 +154,7 @@ open class AbstractJsIrLineNumberTest : AbstractJsIrTest(
open class AbstractSourceMapGenerationSmokeTest : AbstractJsIrTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/sourcemap/",
testGroupOutputDirPrefix = "sourcemap/"
testGroupOutputDirPrefix = "irSourcemap/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
@@ -0,0 +1,51 @@
/*
* 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.js.test.fir;
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.Nested;
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.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/sourcemap")
@TestDataPath("$PROJECT_ROOT")
public class FirSourceMapGenerationSmokeTestGenerated extends AbstractFirSourceMapGenerationSmokeTest {
@Test
public void testAllFilesPresentInSourcemap() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/sourcemap"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("binaryOperation.kt")
public void testBinaryOperation() throws Exception {
runTest("js/js.translator/testData/sourcemap/binaryOperation.kt");
}
@Test
@TestMetadata("emptyIfInsideInlineLambda.kt")
public void testEmptyIfInsideInlineLambda() throws Exception {
runTest("js/js.translator/testData/sourcemap/emptyIfInsideInlineLambda.kt");
}
@Test
@TestMetadata("expressionBody.kt")
public void testExpressionBody() throws Exception {
runTest("js/js.translator/testData/sourcemap/expressionBody.kt");
}
@Test
@TestMetadata("methodCallInMethod.kt")
public void testMethodCallInMethod() throws Exception {
runTest("js/js.translator/testData/sourcemap/methodCallInMethod.kt");
}
}