JS: move more test to box tests
This commit is contained in:
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.js.test
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.JsProgram
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiManager
|
||||
@@ -56,6 +57,7 @@ import java.io.Closeable
|
||||
import java.io.File
|
||||
import java.io.PrintStream
|
||||
import java.nio.charset.Charset
|
||||
import java.util.regex.Pattern
|
||||
|
||||
abstract class BasicBoxTest(
|
||||
private val pathToTestDir: String,
|
||||
@@ -125,7 +127,7 @@ abstract class BasicBoxTest(
|
||||
.takeWhile { it != stopFile }
|
||||
.map { it.name }
|
||||
.toList().asReversed()
|
||||
.fold(File(pathToOutputDir)) { dir, name -> File(dir, name) }
|
||||
.fold(File(pathToOutputDir), ::File)
|
||||
}
|
||||
|
||||
private fun TestModule.outputFileName(directory: File): String {
|
||||
@@ -172,14 +174,21 @@ abstract class BasicBoxTest(
|
||||
val outputDir = outputFile.parentFile ?: error("Parent file for output file should not be null, outputFilePath: " + outputFile.path)
|
||||
outputFiles.writeAllTo(outputDir)
|
||||
|
||||
if (config.moduleKind == ModuleKind.COMMON_JS) {
|
||||
val content = FileUtil.loadFile(outputFile, true)
|
||||
val wrappedContent = "__beginModule__();\n" +
|
||||
"$content\n" +
|
||||
"__endModule__(\"${StringUtil.escapeStringCharacters(config.moduleId)}\");"
|
||||
FileUtil.writeToFile(outputFile, wrappedContent)
|
||||
}
|
||||
|
||||
processJsProgram(translationResult.program, psiFiles)
|
||||
}
|
||||
|
||||
protected fun processJsProgram(program: JsProgram, psiFiles: List<KtFile>) {
|
||||
for (file in psiFiles) {
|
||||
val text = file.text
|
||||
DirectiveTestUtils.processDirectives(program, text)
|
||||
}
|
||||
psiFiles.asSequence()
|
||||
.map { it.text }
|
||||
.forEach { DirectiveTestUtils.processDirectives(program, it) }
|
||||
program.verifyAst()
|
||||
}
|
||||
|
||||
@@ -198,6 +207,7 @@ abstract class BasicBoxTest(
|
||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + dependencies)
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name)
|
||||
configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind)
|
||||
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5)
|
||||
|
||||
//configuration.put(JSConfigurationKeys.SOURCE_MAP, shouldGenerateSourceMap())
|
||||
@@ -219,13 +229,13 @@ abstract class BasicBoxTest(
|
||||
}
|
||||
|
||||
if (module != null) {
|
||||
val moduleKindString = directives["MODULE_KIND"]
|
||||
if (moduleKindString != null) {
|
||||
module.moduleKind = ModuleKind.valueOf(moduleKindString)
|
||||
val moduleKindMatcher = MODULE_KIND_PATTERN.matcher(text)
|
||||
if (moduleKindMatcher.find()) {
|
||||
module.moduleKind = ModuleKind.valueOf(moduleKindMatcher.group(1))
|
||||
}
|
||||
|
||||
if ("NO_INLINE" in directives) {
|
||||
module.inliningDisabled = false
|
||||
if (NO_INLINE_PATTERN.matcher(text).find()) {
|
||||
module.inliningDisabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +251,7 @@ abstract class BasicBoxTest(
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
FileUtil.delete(tmpDir);
|
||||
FileUtil.delete(tmpDir)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,5 +277,8 @@ abstract class BasicBoxTest(
|
||||
|
||||
companion object {
|
||||
val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
||||
|
||||
private val MODULE_KIND_PATTERN = Pattern.compile("^// *MODULE_KIND: *(.+)$", Pattern.MULTILINE)
|
||||
private val NO_INLINE_PATTERN = Pattern.compile("^// *NO_INLINE *$", Pattern.MULTILINE)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
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.MainCallParameters
|
||||
import org.jetbrains.kotlin.js.test.rhino.RhinoFunctionResultChecker
|
||||
import org.jetbrains.kotlin.js.test.utils.JsTestUtils.getAllFilesInDir
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class MultipleModulesTranslationTest(main: String) : BasicTest(main) {
|
||||
private val MAIN_MODULE_NAME: String = "main"
|
||||
private var dependencies: Map<String, List<String>>? = null
|
||||
protected var moduleKind = ModuleKind.PLAIN
|
||||
|
||||
override fun checkFooBoxIsOkByPath(filePath: String) {
|
||||
val dirName = getTestName(true)
|
||||
dependencies = readModuleDependencies(filePath)
|
||||
|
||||
// KT-7428: !! is necessary here
|
||||
for ((moduleName, dependencies) in dependencies!!) {
|
||||
translateModule(dirName, filePath, moduleName, dependencies)
|
||||
}
|
||||
|
||||
val filename = getInputFilePath(getModuleDirectoryName(dirName, MAIN_MODULE_NAME) + File.separator + MAIN_MODULE_NAME + ".kt")
|
||||
val packageName = getPackageName(filename)
|
||||
runMultiModuleTest(dirName, packageName, BasicTest.TEST_FUNCTION, "OK")
|
||||
}
|
||||
|
||||
private fun runMultiModuleTest(dirName: String, packageName: String, functionName: String, expectedResult: Any) {
|
||||
val moduleDirectoryName = getModuleDirectoryName(dirName, MAIN_MODULE_NAME)
|
||||
runRhinoTests(moduleDirectoryName, BasicTest.DEFAULT_ECMA_VERSIONS, RhinoFunctionResultChecker(MAIN_MODULE_NAME, packageName, functionName, expectedResult))
|
||||
}
|
||||
|
||||
private fun translateModule(dirName: String, pathToDir: String, moduleName: String, dependencies: List<String>) {
|
||||
val moduleDirectoryName = getModuleDirectoryName(dirName, moduleName)
|
||||
val fullFilePaths = getAllFilesInDir(pathToDir + File.separator + moduleName)
|
||||
|
||||
BasicTest.DEFAULT_ECMA_VERSIONS.forEach { version ->
|
||||
val libraries = arrayListOf<String>()
|
||||
for (dependencyName in dependencies) {
|
||||
libraries.add(getMetaFileOutputPath(getModuleDirectoryName(dirName, dependencyName), version))
|
||||
}
|
||||
generateJavaScriptFiles(fullFilePaths, moduleDirectoryName, MainCallParameters.noCall(), version, moduleName, libraries)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMetaFileOutputPath(moduleDirectoryName: String, version: EcmaVersion) =
|
||||
KotlinJavascriptMetadataUtils.replaceSuffix(getOutputFilePath(moduleDirectoryName, version))
|
||||
|
||||
override fun setupConfig(configuration: CompilerConfiguration) {
|
||||
val method = try {
|
||||
javaClass.getMethod(name)
|
||||
}
|
||||
catch (e: NoSuchMethodException) {
|
||||
return
|
||||
}
|
||||
|
||||
method.getAnnotation(WithModuleKind::class.java)?.let { moduleKind = it.value }
|
||||
configuration.put(JSConfigurationKeys.MODULE_KIND, moduleKind)
|
||||
}
|
||||
|
||||
override fun shouldGenerateMetaInfo() = true
|
||||
|
||||
override fun additionalJsFiles(ecmaVersion: EcmaVersion): List<String> {
|
||||
val result = mutableListOf(MODULE_EMULATION_FILE)
|
||||
result += super.additionalJsFiles(ecmaVersion)
|
||||
val dirName = getTestName(true)
|
||||
assert(dependencies != null) { "dependencies should not be null" }
|
||||
|
||||
for (moduleName in dependencies!!.keys) {
|
||||
if (moduleName != MAIN_MODULE_NAME) {
|
||||
result.add(getOutputFilePath(getModuleDirectoryName(dirName, moduleName), ecmaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override fun translateFiles(jetFiles: MutableList<KtFile>, outputFile: File, mainCallParameters: MainCallParameters,
|
||||
config: JsConfig) {
|
||||
super.translateFiles(jetFiles, outputFile, mainCallParameters, config)
|
||||
|
||||
if (config.moduleKind == ModuleKind.COMMON_JS) {
|
||||
val content = FileUtil.loadFile(outputFile, true)
|
||||
val wrappedContent = "__beginModule__();\n" +
|
||||
"$content\n" +
|
||||
"__endModule__(\"${StringUtil.escapeStringCharacters(config.moduleId)}\");"
|
||||
FileUtil.writeToFile(outputFile, wrappedContent)
|
||||
// TODO: it would be better to wrap output before JS file is actually written
|
||||
}
|
||||
}
|
||||
|
||||
private fun readModuleDependencies(testDataDir: String): Map<String, List<String>> {
|
||||
val dependenciesTxt = upsearchFile(testDataDir, "dependencies.txt")
|
||||
assert(dependenciesTxt.isFile) { "moduleDependencies should not be null" }
|
||||
|
||||
val result = LinkedHashMap<String, List<String>>()
|
||||
for (line in dependenciesTxt.readLines()) {
|
||||
val split = line.split("->")
|
||||
val module = split[0]
|
||||
val dependencies = if (split.size > 1) split[1] else ""
|
||||
val dependencyList = dependencies.split(",").filterNot { it.isEmpty() }
|
||||
|
||||
result[module] = dependencyList
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private fun upsearchFile(startingDir: String, name: String): File {
|
||||
var dir: File? = File(startingDir)
|
||||
var file = File(dir, name)
|
||||
|
||||
while (dir != null && dir.isDirectory && !file.isFile) {
|
||||
dir = dir.parentFile
|
||||
file = File(dir, name)
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test
|
||||
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class WithModuleKind(val value: ModuleKind)
|
||||
@@ -4532,6 +4532,198 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiFile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MultiFile extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInMultiFile() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiFile"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classOfTheSameNameInAnotherPackage.kt")
|
||||
public void testClassOfTheSameNameInAnotherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiFile/classOfTheSameNameInAnotherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classesInheritedFromOtherFile.kt")
|
||||
public void testClassesInheritedFromOtherFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiFile/classesInheritedFromOtherFile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionsVisibleFromOtherFile.kt")
|
||||
public void testFunctionsVisibleFromOtherFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiFile/functionsVisibleFromOtherFile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModule")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MultiModule extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInMultiModule() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleAndVariableNameClash.kt")
|
||||
public void testModuleAndVariableNameClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModule/moduleAndVariableNameClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("useElementsFromDefaultPackageInAnotherModule.kt")
|
||||
public void testUseElementsFromDefaultPackageInAnotherModule() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModule/useElementsFromDefaultPackageInAnotherModule.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModuleWrappers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MultiModuleWrappers extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInMultiModuleWrappers() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModuleWrappers"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModuleWrappers/amd")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Amd extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInAmd() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModuleWrappers/amd"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleWithNonIdentifierName.kt")
|
||||
public void testModuleWithNonIdentifierName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/amd/moduleWithNonIdentifierName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/amd/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModuleWrappers/common_js")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Common_js extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInCommon_js() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModuleWrappers/common_js"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleWithNonIdentifierName.kt")
|
||||
public void testModuleWithNonIdentifierName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/common_js/moduleWithNonIdentifierName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/common_js/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModuleWrappers/plain")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Plain extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInPlain() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModuleWrappers/plain"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleWithNonIdentifierName.kt")
|
||||
public void testModuleWithNonIdentifierName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/plain/moduleWithNonIdentifierName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/plain/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiModuleWrappers/umd")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Umd extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInUmd() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModuleWrappers/umd"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleWithNonIdentifierName.kt")
|
||||
public void testModuleWithNonIdentifierName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/umd/moduleWithNonIdentifierName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multiModuleWrappers/umd/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multideclaration")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Multideclaration extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInMultideclaration() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multideclaration"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValForArray.kt")
|
||||
public void testMultiValForArray() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValForArray.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValForMap.kt")
|
||||
public void testMultiValForMap() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValForMap.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValForRange.kt")
|
||||
public void testMultiValForRange() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValForRange.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValInFor.kt")
|
||||
public void testMultiValInFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValInFor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValInIntFor.kt")
|
||||
public void testMultiValInIntFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValInIntFor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValInIntRangeFor.kt")
|
||||
public void testMultiValInIntRangeFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValInIntRangeFor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiValOrVar.kt")
|
||||
public void testMultiValOrVar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/multideclaration/multiValOrVar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/operatorOverloading")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
public class MultiDeclarationTest extends SingleFileTranslationTest {
|
||||
public MultiDeclarationTest() {
|
||||
super("multideclaration/");
|
||||
}
|
||||
|
||||
// TODO: Add support Map.Entry
|
||||
public void TestMultiValForMap() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMultiValOrVar() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMultiValInFor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMultiValInIntFor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMultiValInIntRangeFor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMultiValForArray() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
// TODO: Add support ranges for user types
|
||||
public void TestMultiValForRange() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import org.jetbrains.kotlin.js.test.MultipleFilesTranslationTest;
|
||||
|
||||
public final class MultiFileTest extends MultipleFilesTranslationTest {
|
||||
|
||||
public MultiFileTest() {
|
||||
super("multiFile/");
|
||||
}
|
||||
|
||||
public void testFunctionsVisibleFromOtherFile() throws Exception {
|
||||
checkFooBoxIsTrue("functionsVisibleFromOtherFile");
|
||||
}
|
||||
|
||||
//TODO: fails on centos-1 build agent, can't reproduce
|
||||
public void TODO_testClassesInheritedFromOtherFile() throws Exception {
|
||||
checkFooBoxIsTrue("classesInheritedFromOtherFile");
|
||||
}
|
||||
|
||||
public void testClassOfTheSameNameInAnotherPackage() throws Exception {
|
||||
checkFooBoxIsTrue("classOfTheSameNameInAnotherPackage");
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
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 */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/multiModule/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class MultiModuleTestGenerated extends AbstractMultiModuleTest {
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/multiModule/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleAndVariableNameClash.kt")
|
||||
public void testModuleAndVariableNameClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/moduleAndVariableNameClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typealiases.kt")
|
||||
public void testTypealiases() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/typealiases.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("useElementsFromDefaultPackageInAnotherModule.kt")
|
||||
public void testUseElementsFromDefaultPackageInAnotherModule() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/useElementsFromDefaultPackageInAnotherModule.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics
|
||||
|
||||
import org.jetbrains.kotlin.js.test.MultipleModulesTranslationTest
|
||||
import org.jetbrains.kotlin.js.test.WithModuleKind
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
|
||||
class MultiModuleWrappersTest() : MultipleModulesTranslationTest("multiModuleWrappers/") {
|
||||
private var overriddenTestName = ""
|
||||
|
||||
@WithModuleKind(ModuleKind.AMD) fun testAmd() {
|
||||
runTest("simple")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.COMMON_JS) fun testCommonJs() {
|
||||
runTest("simple")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.UMD) fun testUmd() {
|
||||
runTest("simple")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.PLAIN) fun testPlain() {
|
||||
runTest("simple")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.AMD) fun testAmdModuleWithNonIdentifierName() {
|
||||
runTest("moduleWithNonIdentifierName")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.COMMON_JS) fun testCommonJsModuleWithNonIdentifierName() {
|
||||
runTest("moduleWithNonIdentifierName")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.UMD) fun testUmdModuleWithNonIdentifierName() {
|
||||
runTest("moduleWithNonIdentifierName")
|
||||
}
|
||||
|
||||
@WithModuleKind(ModuleKind.PLAIN) fun testPlainModuleWithNonIdentifierName() {
|
||||
runTest("moduleWithNonIdentifierName")
|
||||
}
|
||||
|
||||
fun runTest(name: String) {
|
||||
overriddenTestName = name
|
||||
doTest("${pathToTestDir()}/cases/$name")
|
||||
}
|
||||
|
||||
override fun getTestName(lowercaseFirstLetter: Boolean) = overriddenTestName
|
||||
|
||||
override fun getOutputPath() = "${super.getOutputPath()}/${moduleKind.name.toLowerCase()}/"
|
||||
}
|
||||
-2
@@ -47,8 +47,6 @@ abstract class AbstractCompanionObjectTest : JsBasicBoxTest("objectIntrinsics/")
|
||||
|
||||
abstract class AbstractFunctionExpressionTest : JsBasicBoxTest("functionExpression/")
|
||||
|
||||
abstract class AbstractMultiModuleTest : JsBasicBoxTest("multiModule/")
|
||||
|
||||
abstract class AbstractReservedWordTest : JsBasicBoxTest("reservedWords/")
|
||||
|
||||
abstract class AbstractSecondaryConstructorTest : JsBasicBoxTest("secondaryConstructors/")
|
||||
|
||||
Reference in New Issue
Block a user