[JS] Migrate the line number tests to the new testing infrastructure

This commit is contained in:
Sergej Jaskiewicz
2022-02-22 16:07:54 +03:00
committed by Space
parent 60eff871dc
commit dc9652e9ce
10 changed files with 168 additions and 240 deletions
+7
View File
@@ -25,6 +25,13 @@
</array>
</value>
</entry>
<entry key="$PROJECT_DIR$/js/js.translator/testData/lineNumbers">
<value>
<array>
<option value="$PROJECT_DIR$/js/js.tests/build/out/lineNumbers/$TEST_DATA_FILE${-lib,}_v5{.js,.js.map,-lines.js}" />
</array>
</value>
</entry>
<entry key="$PROJECT_DIR$/js/js.translator/testData/sourcemap">
<value>
<array>
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.incremental.AbstractInvalidationTest
import org.jetbrains.kotlin.js.test.*
import org.jetbrains.kotlin.js.test.ir.*
import org.jetbrains.kotlin.js.testOld.AbstractDceTest
import org.jetbrains.kotlin.js.testOld.AbstractJsLineNumberTest
import org.jetbrains.kotlin.js.testOld.compatibility.binary.AbstractJsKlibBinaryCompatibilityTest
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenBoxWasmTest
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenWasmJsInteropWasmTest
@@ -41,10 +40,6 @@ fun main(args: Array<String>) {
testClass<AbstractDceTest> {
model("dce/", pattern = "(.+)\\.js", targetBackend = TargetBackend.JS)
}
testClass<AbstractJsLineNumberTest> {
model("lineNumbers/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS)
}
}
testGroup("js/js.tests/tests-gen", "compiler/testData") {
@@ -111,6 +106,10 @@ fun main(args: Array<String>) {
model("webDemoExamples/")
}
testClass<AbstractJsLineNumberTest> {
model("lineNumbers/")
}
testClass<AbstractIrBoxJsTest> {
model("box/", pattern = "^([^_](.+))\\.kt$")
}
@@ -163,3 +163,22 @@ open class AbstractWebDemoExamplesTest : AbstractJsTest(
}
}
}
open class AbstractJsLineNumberTest : AbstractJsTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/lineNumbers/",
testGroupOutputDirPrefix = "lineNumbers/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+JsEnvironmentConfigurationDirectives.NO_COMMON_FILES
-JsEnvironmentConfigurationDirectives.GENERATE_NODE_JS_RUNNER
JsEnvironmentConfigurationDirectives.DONT_RUN_GENERATED_CODE.with(listOf("JS", "JS_IR", "JS_IR_ES6"))
}
configureJsArtifactsHandlersStep {
useHandlers(::JsLineNumberHandler)
}
}
}
}
@@ -0,0 +1,66 @@
/*
* 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.js.test.handlers
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.TranslationMode
import org.jetbrains.kotlin.js.facade.TranslationResult
import org.jetbrains.kotlin.js.test.utils.LineCollector
import org.jetbrains.kotlin.js.test.utils.LineOutputToStringVisitor
import org.jetbrains.kotlin.js.util.TextOutputImpl
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
import org.jetbrains.kotlin.test.model.BinaryArtifacts
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
import java.io.File
class JsLineNumberHandler(testServices: TestServices) : JsBinaryArtifactHandler(testServices) {
companion object {
private val LINES_PATTERN = Regex("^ *// *LINES: *(.*)$", RegexOption.MULTILINE)
}
private val defaultTranslationMode = TranslationMode.PER_MODULE
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {}
override fun processModule(module: TestModule, info: BinaryArtifacts.Js) {
val translationResult = when (val artifact = info.unwrap()) {
is BinaryArtifacts.Js.OldJsArtifact -> artifact.translationResult as TranslationResult.Success
// TODO: Support JS IR
// is BinaryArtifacts.Js.JsIrArtifact -> artifact.compilerResult.outputs[defaultTranslationMode]!!.jsProgram!!
else -> error("This artifact is not supported")
}
val jsProgram = translationResult.program
val baseOutputPath = JsEnvironmentConfigurator.getJsModuleArtifactPath(testServices, module.name, defaultTranslationMode)
val lineCollector = LineCollector()
lineCollector.accept(jsProgram)
val programOutput = TextOutputImpl()
jsProgram.globalBlock.accept(LineOutputToStringVisitor(programOutput, lineCollector))
val generatedCode = programOutput.toString()
with(File("$baseOutputPath-lines.js")) {
parentFile.mkdirs()
writeText(generatedCode)
}
val linesMatcher = module.files
.firstNotNullOfOrNull { LINES_PATTERN.find(it.originalContent) }
?: error("'// LINES: ' comment was not found in source file. Generated code is:\n$generatedCode")
val expectedLines = linesMatcher.groups[1]!!.value
val actualLines = lineCollector.lines
.dropLastWhile { it == null }
.joinToString(" ") { if (it == null) "*" else (it + 1).toString() }
testServices.assertions.assertEquals(expectedLines, actualLines) { generatedCode }
}
}
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.js.sourceMap.SourceFilePathResolver
import org.jetbrains.kotlin.js.sourceMap.SourceMap3Builder
import org.jetbrains.kotlin.js.sourceMap.SourceMapBuilderConsumer
import org.jetbrains.kotlin.js.testOld.utils.AmbiguousAstSourcePropagation
import org.jetbrains.kotlin.js.testOld.utils.toStringWithLineNumbers
import org.jetbrains.kotlin.js.test.utils.toStringWithLineNumbers
import org.jetbrains.kotlin.js.util.TextOutputImpl
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
@@ -1,20 +1,9 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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.js.testOld.utils
package org.jetbrains.kotlin.js.test.utils
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.js.backend.ast.*
@@ -170,4 +159,4 @@ class LineCollector : RecursiveJsVisitor() {
}
currentStatement = oldStatement
}
}
}
@@ -1,20 +1,9 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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.js.testOld.utils
package org.jetbrains.kotlin.js.test.utils
import org.jetbrains.kotlin.js.backend.JsToStringGenerationVisitor
import org.jetbrains.kotlin.js.backend.ast.*
@@ -93,4 +82,4 @@ class LineOutputToStringVisitor(output: TextOutput, val lineCollector: LineColle
p.print(" */ ")
}
}
}
}
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.js.testOld.utils
package org.jetbrains.kotlin.js.test.utils
import org.jetbrains.kotlin.js.backend.ast.JsProgram
import org.jetbrains.kotlin.js.util.TextOutputImpl
@@ -24,4 +24,4 @@ fun JsProgram.toStringWithLineNumbers(): String {
val lineCollector = LineCollector().also { it.accept(this) }
LineOutputToStringVisitor(output, lineCollector).accept(this.globalBlock)
return output.toString()
}
}
@@ -1,184 +0,0 @@
/*
* Copyright 2010-2021 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.testOld
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiManager
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.js.config.EcmaVersion
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.config.JsConfig
import org.jetbrains.kotlin.js.facade.K2JSTranslator
import org.jetbrains.kotlin.js.facade.MainCallParameters
import org.jetbrains.kotlin.js.facade.TranslationResult
import org.jetbrains.kotlin.js.facade.TranslationUnit
import org.jetbrains.kotlin.js.testOld.utils.ExceptionThrowingReporter
import org.jetbrains.kotlin.js.testOld.utils.LineCollector
import org.jetbrains.kotlin.js.testOld.utils.LineOutputToStringVisitor
import org.jetbrains.kotlin.js.util.TextOutputImpl
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.CompilerEnvironment
import org.jetbrains.kotlin.serialization.js.ModuleKind
import org.jetbrains.kotlin.test.Directives
import org.jetbrains.kotlin.test.KotlinBaseTest
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
import org.jetbrains.kotlin.test.TestFiles
import org.jetbrains.kotlin.test.services.ModuleStructureExtractor
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.jetbrains.kotlin.utils.DFS
import java.io.ByteArrayOutputStream
import java.io.Closeable
import java.io.File
import java.io.PrintStream
import java.nio.charset.Charset
abstract class AbstractJsLineNumberTest : KotlinTestWithEnvironment() {
fun doTest(filePath: String) {
val file = File(filePath)
val sourceCode = file.readText()
TestFileFactoryImpl().use { testFactory ->
val inputFiles = TestFiles.createTestFiles(file.name, sourceCode, testFactory, true)
val modules = inputFiles
.map { it.module }.distinct()
.associateBy { it.name }
val orderedModules = DFS.topologicalOrder(modules.values) { module -> module.dependenciesSymbols.mapNotNull { modules[it] } }
orderedModules.asReversed().forEach { module ->
val baseOutputPath = module.outputFileName(file)
val translator = K2JSTranslator(createConfig(module, file, modules), false)
val units = module.files.map { TranslationUnit.SourceFile(createPsiFile(it.fileName)) }
val translationResult = translator.translateUnits(ExceptionThrowingReporter, units, MainCallParameters.noCall())
if (translationResult !is TranslationResult.Success) {
val outputStream = ByteArrayOutputStream()
val collector = PrintingMessageCollector(PrintStream(outputStream), MessageRenderer.PLAIN_FULL_PATHS, true)
AnalyzerWithCompilerReport.reportDiagnostics(translationResult.diagnostics, collector, renderInternalDiagnosticName = false)
val messages = outputStream.toByteArray().toString(Charset.forName("UTF-8"))
throw AssertionError("The following errors occurred compiling test:\n" + messages)
}
val lineCollector = LineCollector()
lineCollector.accept(translationResult.program)
val programOutput = TextOutputImpl()
translationResult.program.globalBlock.accept(LineOutputToStringVisitor(programOutput, lineCollector))
val generatedCode = programOutput.toString()
with(File(baseOutputPath + "-lines.js")) {
parentFile.mkdirs()
writeText(generatedCode)
}
val baseDir = File(baseOutputPath).parentFile
for (outputFile in translationResult.getOutputFiles(File(baseOutputPath + ".js"), null, null).asList()) {
with (File(baseDir, outputFile.relativePath)) {
parentFile.mkdirs()
writeBytes(outputFile.asByteArray())
}
}
val linesMatcher = module.files
.mapNotNull { LINES_PATTERN.find(File(it.fileName).readText()) }
.firstOrNull()
?: error("'// LINES: ' comment was not found in source file. Generated code is:\n$generatedCode")
val expectedLines = linesMatcher.groups[1]!!.value
val actualLines = lineCollector.lines
.dropLastWhile { it == null }
.joinToString(" ") { if (it == null) "*" else (it + 1).toString() }
TestCase.assertEquals(generatedCode, expectedLines, actualLines)
}
}
}
private fun TestModule.outputFileName(file: File): String = outputPath(file) + "-" + name
private fun outputPath(file: File) = File(OUT_PATH, file.relativeTo(File(BASE_PATH)).path.removeSuffix(".kt")).path
override fun createEnvironment(): KotlinCoreEnvironment =
KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
private fun createConfig(module: TestModule, inputFile: File, modules: Map<String, TestModule>): JsConfig {
val dependencies = module.dependenciesSymbols
.mapNotNull { modules[it]?.outputFileName(inputFile) }
.map { "$it.meta.js" }
val configuration = environment.configuration.copy()
configuration.put(JSConfigurationKeys.LIBRARIES, JsConfig.JS_STDLIB + JsConfig.JS_KOTLIN_TEST + dependencies)
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name)
configuration.put(JSConfigurationKeys.MODULE_KIND, ModuleKind.PLAIN)
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5)
configuration.put(JSConfigurationKeys.SOURCE_MAP, true)
configuration.put(JSConfigurationKeys.META_INFO, true)
return JsConfig(project, configuration, CompilerEnvironment)
}
private fun createPsiFile(fileName: String): KtFile {
val psiManager = PsiManager.getInstance(project)
val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
return psiManager.findFile(fileSystem.findFileByPath(fileName)!!) as KtFile
}
private inner class TestFileFactoryImpl : TestFiles.TestFileFactory<TestModule, TestFile>, Closeable {
private val tmpDir = KtTestUtil.tmpDir("js-tests")
private val defaultModule = TestModule(ModuleStructureExtractor.DEFAULT_MODULE_NAME, emptyList(), emptyList())
override fun createFile(module: TestModule?, fileName: String, text: String, directives: Directives): TestFile? {
val currentModule = module ?: defaultModule
val temporaryFile = File(tmpDir, "${currentModule.name}/$fileName")
KtTestUtil.mkdirs(temporaryFile.parentFile)
temporaryFile.writeText(text, Charsets.UTF_8)
return TestFile(temporaryFile.absolutePath, text, currentModule, directives)
}
override fun createModule(name: String, dependencies: List<String>, friends: List<String>, abiVersion: List<Int>) = TestModule(name, dependencies, friends)
override fun close() {
FileUtil.delete(tmpDir)
}
}
private class TestModule(
name: String,
dependenciesSymbols: List<String>,
friendsSymbols: List<String>
): KotlinBaseTest.TestModule(name, dependenciesSymbols, friendsSymbols) {
val files = mutableListOf<TestFile>()
}
private class TestFile(val fileName: String, content: String, val module: TestModule, directives: Directives) :
KotlinBaseTest.TestFile(fileName, content, directives) {
init {
module.files += this
}
}
companion object {
private val DIR_NAME = "lineNumbers"
private val LINES_PATTERN = Regex("^ *// *LINES: *(.*)$", RegexOption.MULTILINE)
private val BASE_PATH = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/$DIR_NAME"
private val OUT_PATH = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/out/$DIR_NAME"
}
}
@@ -3,295 +3,338 @@
* 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.testOld;
package org.jetbrains.kotlin.js.test;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
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.TestsPackage}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/lineNumbers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
@Test
public void testAllFilesPresentInLineNumbers() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("andAndWithSideEffect.kt")
public void testAndAndWithSideEffect() throws Exception {
runTest("js/js.translator/testData/lineNumbers/andAndWithSideEffect.kt");
}
@Test
@TestMetadata("backingField.kt")
public void testBackingField() throws Exception {
runTest("js/js.translator/testData/lineNumbers/backingField.kt");
}
@Test
@TestMetadata("catch.kt")
public void testCatch() throws Exception {
runTest("js/js.translator/testData/lineNumbers/catch.kt");
}
@Test
@TestMetadata("chainedCall.kt")
public void testChainedCall() throws Exception {
runTest("js/js.translator/testData/lineNumbers/chainedCall.kt");
}
@Test
@TestMetadata("classCapturingLocals.kt")
public void testClassCapturingLocals() throws Exception {
runTest("js/js.translator/testData/lineNumbers/classCapturingLocals.kt");
}
@Test
@TestMetadata("closure.kt")
public void testClosure() throws Exception {
runTest("js/js.translator/testData/lineNumbers/closure.kt");
}
@Test
@TestMetadata("complexExpressionAsDefaultArgument.kt")
public void testComplexExpressionAsDefaultArgument() throws Exception {
runTest("js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt");
}
@Test
@TestMetadata("conditionalDecomposed.kt")
public void testConditionalDecomposed() throws Exception {
runTest("js/js.translator/testData/lineNumbers/conditionalDecomposed.kt");
}
@Test
@TestMetadata("coroutine.kt")
public void testCoroutine() throws Exception {
runTest("js/js.translator/testData/lineNumbers/coroutine.kt");
}
@Test
@TestMetadata("coroutineNullAssertion.kt")
public void testCoroutineNullAssertion() throws Exception {
runTest("js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt");
}
@Test
@TestMetadata("dataClass.kt")
public void testDataClass() throws Exception {
runTest("js/js.translator/testData/lineNumbers/dataClass.kt");
}
@Test
@TestMetadata("delegateMemberVal.kt")
public void testDelegateMemberVal() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegateMemberVal.kt");
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegatedProperty.kt");
}
@Test
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegation.kt");
}
@Test
@TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception {
runTest("js/js.translator/testData/lineNumbers/destructuring.kt");
}
@Test
@TestMetadata("destructuringInline.kt")
public void testDestructuringInline() throws Exception {
runTest("js/js.translator/testData/lineNumbers/destructuringInline.kt");
}
@Test
@TestMetadata("doWhileWithComplexCondition.kt")
public void testDoWhileWithComplexCondition() throws Exception {
runTest("js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt");
}
@Test
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("js/js.translator/testData/lineNumbers/elvis.kt");
}
@Test
@TestMetadata("enumCompanionObject.kt")
public void testEnumCompanionObject() throws Exception {
runTest("js/js.translator/testData/lineNumbers/enumCompanionObject.kt");
}
@Test
@TestMetadata("enumObject.kt")
public void testEnumObject() throws Exception {
runTest("js/js.translator/testData/lineNumbers/enumObject.kt");
}
@Test
@TestMetadata("expressionAsFunctionBody.kt")
public void testExpressionAsFunctionBody() throws Exception {
runTest("js/js.translator/testData/lineNumbers/expressionAsFunctionBody.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("js/js.translator/testData/lineNumbers/for.kt");
}
@Test
@TestMetadata("increment.kt")
public void testIncrement() throws Exception {
runTest("js/js.translator/testData/lineNumbers/increment.kt");
}
@Test
@TestMetadata("inlineArguments.kt")
public void testInlineArguments() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineArguments.kt");
}
@Test
@TestMetadata("inlineLocalVarsRef.kt")
public void testInlineLocalVarsRef() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt");
}
@Test
@TestMetadata("inlineReturn.kt")
public void testInlineReturn() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineReturn.kt");
}
@Test
@TestMetadata("inlining.kt")
public void testInlining() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlining.kt");
}
@Test
@TestMetadata("inliningWithLambda.kt")
public void testInliningWithLambda() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inliningWithLambda.kt");
}
@Test
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("js/js.translator/testData/lineNumbers/innerClass.kt");
}
@Test
@TestMetadata("isOperator.kt")
public void testIsOperator() throws Exception {
runTest("js/js.translator/testData/lineNumbers/isOperator.kt");
}
@Test
@TestMetadata("jsCode.kt")
public void testJsCode() throws Exception {
runTest("js/js.translator/testData/lineNumbers/jsCode.kt");
}
@Test
@TestMetadata("lambdaWithClosure.kt")
public void testLambdaWithClosure() throws Exception {
runTest("js/js.translator/testData/lineNumbers/lambdaWithClosure.kt");
}
@Test
@TestMetadata("lastExpressionInInlineLambda.kt")
public void testLastExpressionInInlineLambda() throws Exception {
runTest("js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt");
}
@Test
@TestMetadata("literals.kt")
public void testLiterals() throws Exception {
runTest("js/js.translator/testData/lineNumbers/literals.kt");
}
@Test
@TestMetadata("longLiteral.kt")
public void testLongLiteral() throws Exception {
runTest("js/js.translator/testData/lineNumbers/longLiteral.kt");
}
@Test
@TestMetadata("memberFunWithDefaultParam.kt")
public void testMemberFunWithDefaultParam() throws Exception {
runTest("js/js.translator/testData/lineNumbers/memberFunWithDefaultParam.kt");
}
@Test
@TestMetadata("multipleReferences.kt")
public void testMultipleReferences() throws Exception {
runTest("js/js.translator/testData/lineNumbers/multipleReferences.kt");
}
@Test
@TestMetadata("objectInstanceFunction.kt")
public void testObjectInstanceFunction() throws Exception {
runTest("js/js.translator/testData/lineNumbers/objectInstanceFunction.kt");
}
@Test
@TestMetadata("optionalArgs.kt")
public void testOptionalArgs() throws Exception {
runTest("js/js.translator/testData/lineNumbers/optionalArgs.kt");
}
@Test
@TestMetadata("propertyWithoutInitializer.kt")
public void testPropertyWithoutInitializer() throws Exception {
runTest("js/js.translator/testData/lineNumbers/propertyWithoutInitializer.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/lineNumbers/simple.kt");
}
@Test
@TestMetadata("stringLiteral.kt")
public void testStringLiteral() throws Exception {
runTest("js/js.translator/testData/lineNumbers/stringLiteral.kt");
}
@Test
@TestMetadata("syntheticCodeInConstructors.kt")
public void testSyntheticCodeInConstructors() throws Exception {
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt");
}
@Test
@TestMetadata("syntheticCodeInEnums.kt")
public void testSyntheticCodeInEnums() throws Exception {
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt");
}
@Test
@TestMetadata("valParameter.kt")
public void testValParameter() throws Exception {
runTest("js/js.translator/testData/lineNumbers/valParameter.kt");
}
@Test
@TestMetadata("whenEntryWithMultipleConditions.kt")
public void testWhenEntryWithMultipleConditions() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt");
}
@Test
@TestMetadata("whenEntryWithMultipleConditionsNonOptimized.kt")
public void testWhenEntryWithMultipleConditionsNonOptimized() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt");
}
@Test
@TestMetadata("whenIn.kt")
public void testWhenIn() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenIn.kt");
}
@Test
@TestMetadata("whenIs.kt")
public void testWhenIs() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenIs.kt");
}
@Test
@TestMetadata("whileWithComplexCondition.kt")
public void testWhileWithComplexCondition() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt");
}
@Nested
@TestMetadata("js/js.translator/testData/lineNumbers/inlineMultiModule")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InlineMultiModule extends AbstractJsLineNumberTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public class InlineMultiModule {
@Test
public void testAllFilesPresentInInlineMultiModule() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers/inlineMultiModule"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers/inlineMultiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt");