Move coroutines to kotlin.coroutines package: tests
Introduce COMMON_COROUTINES_TEST directive. Every test with this directive is run twice: one time with language version 1.2 and kotlin.coroutines.experimental package and the other time with language version 1.3 and kotlin.coroutines package. Each run is a separate method: with suffixes _1_2 and _1_3 respectively. However, since codegen of release coroutines is not supported in JS backend, we generate only one method: with suffix _1_2. #KT-23362
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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-2018 JetBrains s.r.o. 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
|
||||
@@ -56,7 +45,7 @@ abstract class AbstractJsLineNumberTest : KotlinTestWithEnvironment() {
|
||||
val sourceCode = file.readText()
|
||||
|
||||
TestFileFactoryImpl().use { testFactory ->
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, sourceCode, testFactory, true)
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, sourceCode, testFactory, true, "")
|
||||
val modules = inputFiles
|
||||
.map { it.module }.distinct()
|
||||
.associateBy { it.name }
|
||||
|
||||
@@ -90,16 +90,24 @@ abstract class BasicBoxTest(
|
||||
doTest(filePath, "OK", MainCallParameters.noCall())
|
||||
}
|
||||
|
||||
fun doTest(filePath: String, expectedResult: String, mainCallParameters: MainCallParameters) {
|
||||
fun doTestWithCoroutinesPackageReplacement(filePath: String, packageName: String) {
|
||||
if (packageName == "kotlin.coroutines") return // TODO: Support JS in kotlin-stdlib-coroutines
|
||||
doTest(filePath, "OK", MainCallParameters.noCall(), packageName)
|
||||
}
|
||||
|
||||
fun doTest(filePath: String, expectedResult: String, mainCallParameters: MainCallParameters, packageName: String = "") {
|
||||
val file = File(filePath)
|
||||
val outputDir = getOutputDir(file)
|
||||
val fileContent = KotlinTestUtils.doLoadFile(file)
|
||||
var fileContent = KotlinTestUtils.doLoadFile(file)
|
||||
if (packageName.isNotEmpty()) {
|
||||
fileContent = fileContent.replace("COROUTINES_PACKAGE", packageName)
|
||||
}
|
||||
|
||||
val outputPrefixFile = getOutputPrefixFile(filePath)
|
||||
val outputPostfixFile = getOutputPostfixFile(filePath)
|
||||
|
||||
TestFileFactoryImpl().use { testFactory ->
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, fileContent, testFactory, true)
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, fileContent, testFactory, true, "")
|
||||
val modules = inputFiles
|
||||
.map { it.module }.distinct()
|
||||
.map { it.name to it }.toMap()
|
||||
|
||||
+610
-414
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user