[JS] Migrate the line number tests to the new testing infrastructure
This commit is contained in:
+7
@@ -25,6 +25,13 @@
|
|||||||
</array>
|
</array>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</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">
|
<entry key="$PROJECT_DIR$/js/js.translator/testData/sourcemap">
|
||||||
<value>
|
<value>
|
||||||
<array>
|
<array>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.incremental.AbstractInvalidationTest
|
|||||||
import org.jetbrains.kotlin.js.test.*
|
import org.jetbrains.kotlin.js.test.*
|
||||||
import org.jetbrains.kotlin.js.test.ir.*
|
import org.jetbrains.kotlin.js.test.ir.*
|
||||||
import org.jetbrains.kotlin.js.testOld.AbstractDceTest
|
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.compatibility.binary.AbstractJsKlibBinaryCompatibilityTest
|
||||||
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenBoxWasmTest
|
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenBoxWasmTest
|
||||||
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenWasmJsInteropWasmTest
|
import org.jetbrains.kotlin.js.testOld.wasm.semantics.AbstractIrCodegenWasmJsInteropWasmTest
|
||||||
@@ -41,10 +40,6 @@ fun main(args: Array<String>) {
|
|||||||
testClass<AbstractDceTest> {
|
testClass<AbstractDceTest> {
|
||||||
model("dce/", pattern = "(.+)\\.js", targetBackend = TargetBackend.JS)
|
model("dce/", pattern = "(.+)\\.js", targetBackend = TargetBackend.JS)
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractJsLineNumberTest> {
|
|
||||||
model("lineNumbers/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testGroup("js/js.tests/tests-gen", "compiler/testData") {
|
testGroup("js/js.tests/tests-gen", "compiler/testData") {
|
||||||
@@ -111,6 +106,10 @@ fun main(args: Array<String>) {
|
|||||||
model("webDemoExamples/")
|
model("webDemoExamples/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractJsLineNumberTest> {
|
||||||
|
model("lineNumbers/")
|
||||||
|
}
|
||||||
|
|
||||||
testClass<AbstractIrBoxJsTest> {
|
testClass<AbstractIrBoxJsTest> {
|
||||||
model("box/", pattern = "^([^_](.+))\\.kt$")
|
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.SourceMap3Builder
|
||||||
import org.jetbrains.kotlin.js.sourceMap.SourceMapBuilderConsumer
|
import org.jetbrains.kotlin.js.sourceMap.SourceMapBuilderConsumer
|
||||||
import org.jetbrains.kotlin.js.testOld.utils.AmbiguousAstSourcePropagation
|
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.js.util.TextOutputImpl
|
||||||
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
|
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
|
||||||
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
|
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
|
||||||
|
|||||||
+4
-15
@@ -1,20 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
* 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.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.js.testOld.utils
|
package org.jetbrains.kotlin.js.test.utils
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.js.backend.ast.*
|
import org.jetbrains.kotlin.js.backend.ast.*
|
||||||
@@ -170,4 +159,4 @@ class LineCollector : RecursiveJsVisitor() {
|
|||||||
}
|
}
|
||||||
currentStatement = oldStatement
|
currentStatement = oldStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-15
@@ -1,20 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
* 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.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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.JsToStringGenerationVisitor
|
||||||
import org.jetbrains.kotlin.js.backend.ast.*
|
import org.jetbrains.kotlin.js.backend.ast.*
|
||||||
@@ -93,4 +82,4 @@ class LineOutputToStringVisitor(output: TextOutput, val lineCollector: LineColle
|
|||||||
p.print(" */ ")
|
p.print(" */ ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* 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.backend.ast.JsProgram
|
||||||
import org.jetbrains.kotlin.js.util.TextOutputImpl
|
import org.jetbrains.kotlin.js.util.TextOutputImpl
|
||||||
@@ -24,4 +24,4 @@ fun JsProgram.toStringWithLineNumbers(): String {
|
|||||||
val lineCollector = LineCollector().also { it.accept(this) }
|
val lineCollector = LineCollector().also { it.accept(this) }
|
||||||
LineOutputToStringVisitor(output, lineCollector).accept(this.globalBlock)
|
LineOutputToStringVisitor(output, lineCollector).accept(this.globalBlock)
|
||||||
return output.toString()
|
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+61
-18
@@ -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.
|
* 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 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.util.KtTestUtil;
|
||||||
import org.jetbrains.kotlin.test.TargetBackend;
|
import org.jetbrains.kotlin.test.TargetBackend;
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
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.io.File;
|
||||||
import java.util.regex.Pattern;
|
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")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("js/js.translator/testData/lineNumbers")
|
@TestMetadata("js/js.translator/testData/lineNumbers")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
|
public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
@Test
|
||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInLineNumbers() throws Exception {
|
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")
|
@TestMetadata("andAndWithSideEffect.kt")
|
||||||
public void testAndAndWithSideEffect() throws Exception {
|
public void testAndAndWithSideEffect() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/andAndWithSideEffect.kt");
|
runTest("js/js.translator/testData/lineNumbers/andAndWithSideEffect.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("backingField.kt")
|
@TestMetadata("backingField.kt")
|
||||||
public void testBackingField() throws Exception {
|
public void testBackingField() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/backingField.kt");
|
runTest("js/js.translator/testData/lineNumbers/backingField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("catch.kt")
|
@TestMetadata("catch.kt")
|
||||||
public void testCatch() throws Exception {
|
public void testCatch() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/catch.kt");
|
runTest("js/js.translator/testData/lineNumbers/catch.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("chainedCall.kt")
|
@TestMetadata("chainedCall.kt")
|
||||||
public void testChainedCall() throws Exception {
|
public void testChainedCall() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/chainedCall.kt");
|
runTest("js/js.translator/testData/lineNumbers/chainedCall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("classCapturingLocals.kt")
|
@TestMetadata("classCapturingLocals.kt")
|
||||||
public void testClassCapturingLocals() throws Exception {
|
public void testClassCapturingLocals() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/classCapturingLocals.kt");
|
runTest("js/js.translator/testData/lineNumbers/classCapturingLocals.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("closure.kt")
|
@TestMetadata("closure.kt")
|
||||||
public void testClosure() throws Exception {
|
public void testClosure() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/closure.kt");
|
runTest("js/js.translator/testData/lineNumbers/closure.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("complexExpressionAsDefaultArgument.kt")
|
@TestMetadata("complexExpressionAsDefaultArgument.kt")
|
||||||
public void testComplexExpressionAsDefaultArgument() throws Exception {
|
public void testComplexExpressionAsDefaultArgument() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt");
|
runTest("js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("conditionalDecomposed.kt")
|
@TestMetadata("conditionalDecomposed.kt")
|
||||||
public void testConditionalDecomposed() throws Exception {
|
public void testConditionalDecomposed() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/conditionalDecomposed.kt");
|
runTest("js/js.translator/testData/lineNumbers/conditionalDecomposed.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("coroutine.kt")
|
@TestMetadata("coroutine.kt")
|
||||||
public void testCoroutine() throws Exception {
|
public void testCoroutine() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/coroutine.kt");
|
runTest("js/js.translator/testData/lineNumbers/coroutine.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("coroutineNullAssertion.kt")
|
@TestMetadata("coroutineNullAssertion.kt")
|
||||||
public void testCoroutineNullAssertion() throws Exception {
|
public void testCoroutineNullAssertion() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt");
|
runTest("js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("dataClass.kt")
|
@TestMetadata("dataClass.kt")
|
||||||
public void testDataClass() throws Exception {
|
public void testDataClass() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/dataClass.kt");
|
runTest("js/js.translator/testData/lineNumbers/dataClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("delegateMemberVal.kt")
|
@TestMetadata("delegateMemberVal.kt")
|
||||||
public void testDelegateMemberVal() throws Exception {
|
public void testDelegateMemberVal() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/delegateMemberVal.kt");
|
runTest("js/js.translator/testData/lineNumbers/delegateMemberVal.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("delegatedProperty.kt")
|
@TestMetadata("delegatedProperty.kt")
|
||||||
public void testDelegatedProperty() throws Exception {
|
public void testDelegatedProperty() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/delegatedProperty.kt");
|
runTest("js/js.translator/testData/lineNumbers/delegatedProperty.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/delegation.kt");
|
runTest("js/js.translator/testData/lineNumbers/delegation.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("destructuring.kt")
|
@TestMetadata("destructuring.kt")
|
||||||
public void testDestructuring() throws Exception {
|
public void testDestructuring() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/destructuring.kt");
|
runTest("js/js.translator/testData/lineNumbers/destructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("destructuringInline.kt")
|
@TestMetadata("destructuringInline.kt")
|
||||||
public void testDestructuringInline() throws Exception {
|
public void testDestructuringInline() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/destructuringInline.kt");
|
runTest("js/js.translator/testData/lineNumbers/destructuringInline.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("doWhileWithComplexCondition.kt")
|
@TestMetadata("doWhileWithComplexCondition.kt")
|
||||||
public void testDoWhileWithComplexCondition() throws Exception {
|
public void testDoWhileWithComplexCondition() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt");
|
runTest("js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("elvis.kt")
|
@TestMetadata("elvis.kt")
|
||||||
public void testElvis() throws Exception {
|
public void testElvis() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/elvis.kt");
|
runTest("js/js.translator/testData/lineNumbers/elvis.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("enumCompanionObject.kt")
|
@TestMetadata("enumCompanionObject.kt")
|
||||||
public void testEnumCompanionObject() throws Exception {
|
public void testEnumCompanionObject() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/enumCompanionObject.kt");
|
runTest("js/js.translator/testData/lineNumbers/enumCompanionObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("enumObject.kt")
|
@TestMetadata("enumObject.kt")
|
||||||
public void testEnumObject() throws Exception {
|
public void testEnumObject() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/enumObject.kt");
|
runTest("js/js.translator/testData/lineNumbers/enumObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("expressionAsFunctionBody.kt")
|
@TestMetadata("expressionAsFunctionBody.kt")
|
||||||
public void testExpressionAsFunctionBody() throws Exception {
|
public void testExpressionAsFunctionBody() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/expressionAsFunctionBody.kt");
|
runTest("js/js.translator/testData/lineNumbers/expressionAsFunctionBody.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("for.kt")
|
@TestMetadata("for.kt")
|
||||||
public void testFor() throws Exception {
|
public void testFor() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/for.kt");
|
runTest("js/js.translator/testData/lineNumbers/for.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("increment.kt")
|
@TestMetadata("increment.kt")
|
||||||
public void testIncrement() throws Exception {
|
public void testIncrement() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/increment.kt");
|
runTest("js/js.translator/testData/lineNumbers/increment.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("inlineArguments.kt")
|
@TestMetadata("inlineArguments.kt")
|
||||||
public void testInlineArguments() throws Exception {
|
public void testInlineArguments() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inlineArguments.kt");
|
runTest("js/js.translator/testData/lineNumbers/inlineArguments.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("inlineLocalVarsRef.kt")
|
@TestMetadata("inlineLocalVarsRef.kt")
|
||||||
public void testInlineLocalVarsRef() throws Exception {
|
public void testInlineLocalVarsRef() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt");
|
runTest("js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("inlineReturn.kt")
|
@TestMetadata("inlineReturn.kt")
|
||||||
public void testInlineReturn() throws Exception {
|
public void testInlineReturn() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inlineReturn.kt");
|
runTest("js/js.translator/testData/lineNumbers/inlineReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("inlining.kt")
|
@TestMetadata("inlining.kt")
|
||||||
public void testInlining() throws Exception {
|
public void testInlining() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inlining.kt");
|
runTest("js/js.translator/testData/lineNumbers/inlining.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("inliningWithLambda.kt")
|
@TestMetadata("inliningWithLambda.kt")
|
||||||
public void testInliningWithLambda() throws Exception {
|
public void testInliningWithLambda() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inliningWithLambda.kt");
|
runTest("js/js.translator/testData/lineNumbers/inliningWithLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("innerClass.kt")
|
@TestMetadata("innerClass.kt")
|
||||||
public void testInnerClass() throws Exception {
|
public void testInnerClass() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/innerClass.kt");
|
runTest("js/js.translator/testData/lineNumbers/innerClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("isOperator.kt")
|
@TestMetadata("isOperator.kt")
|
||||||
public void testIsOperator() throws Exception {
|
public void testIsOperator() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/isOperator.kt");
|
runTest("js/js.translator/testData/lineNumbers/isOperator.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("jsCode.kt")
|
@TestMetadata("jsCode.kt")
|
||||||
public void testJsCode() throws Exception {
|
public void testJsCode() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/jsCode.kt");
|
runTest("js/js.translator/testData/lineNumbers/jsCode.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("lambdaWithClosure.kt")
|
@TestMetadata("lambdaWithClosure.kt")
|
||||||
public void testLambdaWithClosure() throws Exception {
|
public void testLambdaWithClosure() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/lambdaWithClosure.kt");
|
runTest("js/js.translator/testData/lineNumbers/lambdaWithClosure.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("lastExpressionInInlineLambda.kt")
|
@TestMetadata("lastExpressionInInlineLambda.kt")
|
||||||
public void testLastExpressionInInlineLambda() throws Exception {
|
public void testLastExpressionInInlineLambda() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt");
|
runTest("js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("literals.kt")
|
@TestMetadata("literals.kt")
|
||||||
public void testLiterals() throws Exception {
|
public void testLiterals() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/literals.kt");
|
runTest("js/js.translator/testData/lineNumbers/literals.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("longLiteral.kt")
|
@TestMetadata("longLiteral.kt")
|
||||||
public void testLongLiteral() throws Exception {
|
public void testLongLiteral() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/longLiteral.kt");
|
runTest("js/js.translator/testData/lineNumbers/longLiteral.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("memberFunWithDefaultParam.kt")
|
@TestMetadata("memberFunWithDefaultParam.kt")
|
||||||
public void testMemberFunWithDefaultParam() throws Exception {
|
public void testMemberFunWithDefaultParam() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/memberFunWithDefaultParam.kt");
|
runTest("js/js.translator/testData/lineNumbers/memberFunWithDefaultParam.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("multipleReferences.kt")
|
@TestMetadata("multipleReferences.kt")
|
||||||
public void testMultipleReferences() throws Exception {
|
public void testMultipleReferences() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/multipleReferences.kt");
|
runTest("js/js.translator/testData/lineNumbers/multipleReferences.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("objectInstanceFunction.kt")
|
@TestMetadata("objectInstanceFunction.kt")
|
||||||
public void testObjectInstanceFunction() throws Exception {
|
public void testObjectInstanceFunction() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/objectInstanceFunction.kt");
|
runTest("js/js.translator/testData/lineNumbers/objectInstanceFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("optionalArgs.kt")
|
@TestMetadata("optionalArgs.kt")
|
||||||
public void testOptionalArgs() throws Exception {
|
public void testOptionalArgs() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/optionalArgs.kt");
|
runTest("js/js.translator/testData/lineNumbers/optionalArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("propertyWithoutInitializer.kt")
|
@TestMetadata("propertyWithoutInitializer.kt")
|
||||||
public void testPropertyWithoutInitializer() throws Exception {
|
public void testPropertyWithoutInitializer() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/propertyWithoutInitializer.kt");
|
runTest("js/js.translator/testData/lineNumbers/propertyWithoutInitializer.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/simple.kt");
|
runTest("js/js.translator/testData/lineNumbers/simple.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("stringLiteral.kt")
|
@TestMetadata("stringLiteral.kt")
|
||||||
public void testStringLiteral() throws Exception {
|
public void testStringLiteral() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/stringLiteral.kt");
|
runTest("js/js.translator/testData/lineNumbers/stringLiteral.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("syntheticCodeInConstructors.kt")
|
@TestMetadata("syntheticCodeInConstructors.kt")
|
||||||
public void testSyntheticCodeInConstructors() throws Exception {
|
public void testSyntheticCodeInConstructors() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt");
|
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("syntheticCodeInEnums.kt")
|
@TestMetadata("syntheticCodeInEnums.kt")
|
||||||
public void testSyntheticCodeInEnums() throws Exception {
|
public void testSyntheticCodeInEnums() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt");
|
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("valParameter.kt")
|
@TestMetadata("valParameter.kt")
|
||||||
public void testValParameter() throws Exception {
|
public void testValParameter() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/valParameter.kt");
|
runTest("js/js.translator/testData/lineNumbers/valParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("whenEntryWithMultipleConditions.kt")
|
@TestMetadata("whenEntryWithMultipleConditions.kt")
|
||||||
public void testWhenEntryWithMultipleConditions() throws Exception {
|
public void testWhenEntryWithMultipleConditions() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt");
|
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("whenEntryWithMultipleConditionsNonOptimized.kt")
|
@TestMetadata("whenEntryWithMultipleConditionsNonOptimized.kt")
|
||||||
public void testWhenEntryWithMultipleConditionsNonOptimized() throws Exception {
|
public void testWhenEntryWithMultipleConditionsNonOptimized() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt");
|
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("whenIn.kt")
|
@TestMetadata("whenIn.kt")
|
||||||
public void testWhenIn() throws Exception {
|
public void testWhenIn() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/whenIn.kt");
|
runTest("js/js.translator/testData/lineNumbers/whenIn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("whenIs.kt")
|
@TestMetadata("whenIs.kt")
|
||||||
public void testWhenIs() throws Exception {
|
public void testWhenIs() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/whenIs.kt");
|
runTest("js/js.translator/testData/lineNumbers/whenIs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("whileWithComplexCondition.kt")
|
@TestMetadata("whileWithComplexCondition.kt")
|
||||||
public void testWhileWithComplexCondition() throws Exception {
|
public void testWhileWithComplexCondition() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt");
|
runTest("js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
@TestMetadata("js/js.translator/testData/lineNumbers/inlineMultiModule")
|
@TestMetadata("js/js.translator/testData/lineNumbers/inlineMultiModule")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
public class InlineMultiModule {
|
||||||
public static class InlineMultiModule extends AbstractJsLineNumberTest {
|
@Test
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInInlineMultiModule() throws Exception {
|
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")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
runTest("js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt");
|
runTest("js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt");
|
||||||
Reference in New Issue
Block a user