JS: move more test to box tests
This commit is contained in:
@@ -109,9 +109,10 @@ public class KotlinTestUtils {
|
|||||||
*
|
*
|
||||||
* Several files may follow one module
|
* Several files may follow one module
|
||||||
*/
|
*/
|
||||||
public static final Pattern FILE_OR_MODULE_PATTERN = Pattern.compile("(?://\\s*MODULE:\\s*(\\w+)(\\(\\w+(?:, \\w+)*\\))?\\s*)?" +
|
public static final Pattern FILE_OR_MODULE_PATTERN = Pattern.compile(
|
||||||
"//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE);
|
"(?://\\s*MODULE:\\s*([\\w\\d_\\-]+)(\\([\\w\\d_\\-]+(?:, [\\w\\d_\\-]+)*\\))?\\s*)?" +
|
||||||
public static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*!(\\w+)(:\\s*(.*)$)?", Pattern.MULTILINE);
|
"//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE);
|
||||||
|
public static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*!([\\w_]+)(:\\s*(.*)$)?", Pattern.MULTILINE);
|
||||||
|
|
||||||
public static final BindingTrace DUMMY_TRACE = new BindingTrace() {
|
public static final BindingTrace DUMMY_TRACE = new BindingTrace() {
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -631,7 +632,7 @@ public class KotlinTestUtils {
|
|||||||
private static List<String> parseDependencies(@Nullable String dependencies) {
|
private static List<String> parseDependencies(@Nullable String dependencies) {
|
||||||
if (dependencies == null) return Collections.emptyList();
|
if (dependencies == null) return Collections.emptyList();
|
||||||
|
|
||||||
Matcher matcher = Pattern.compile("\\w+").matcher(dependencies);
|
Matcher matcher = Pattern.compile("[\\w\\d_\\-]+").matcher(dependencies);
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
result.add(matcher.group());
|
result.add(matcher.group());
|
||||||
|
|||||||
@@ -1145,10 +1145,6 @@ fun main(args: Array<String>) {
|
|||||||
model("reservedWords/cases")
|
model("reservedWords/cases")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractMultiModuleTest>() {
|
|
||||||
model("multiModule/cases")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractReifiedTest>() {
|
testClass<AbstractReifiedTest>() {
|
||||||
model("reified/cases")
|
model("reified/cases")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.js.test
|
|||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.JsProgram
|
import com.google.dart.compiler.backend.js.ast.JsProgram
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
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.StandardFileSystems
|
||||||
import com.intellij.openapi.vfs.VirtualFileManager
|
import com.intellij.openapi.vfs.VirtualFileManager
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
@@ -56,6 +57,7 @@ import java.io.Closeable
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
abstract class BasicBoxTest(
|
abstract class BasicBoxTest(
|
||||||
private val pathToTestDir: String,
|
private val pathToTestDir: String,
|
||||||
@@ -125,7 +127,7 @@ abstract class BasicBoxTest(
|
|||||||
.takeWhile { it != stopFile }
|
.takeWhile { it != stopFile }
|
||||||
.map { it.name }
|
.map { it.name }
|
||||||
.toList().asReversed()
|
.toList().asReversed()
|
||||||
.fold(File(pathToOutputDir)) { dir, name -> File(dir, name) }
|
.fold(File(pathToOutputDir), ::File)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TestModule.outputFileName(directory: File): String {
|
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)
|
val outputDir = outputFile.parentFile ?: error("Parent file for output file should not be null, outputFilePath: " + outputFile.path)
|
||||||
outputFiles.writeAllTo(outputDir)
|
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)
|
processJsProgram(translationResult.program, psiFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun processJsProgram(program: JsProgram, psiFiles: List<KtFile>) {
|
protected fun processJsProgram(program: JsProgram, psiFiles: List<KtFile>) {
|
||||||
for (file in psiFiles) {
|
psiFiles.asSequence()
|
||||||
val text = file.text
|
.map { it.text }
|
||||||
DirectiveTestUtils.processDirectives(program, text)
|
.forEach { DirectiveTestUtils.processDirectives(program, it) }
|
||||||
}
|
|
||||||
program.verifyAst()
|
program.verifyAst()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +207,7 @@ abstract class BasicBoxTest(
|
|||||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + dependencies)
|
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + dependencies)
|
||||||
|
|
||||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name)
|
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name)
|
||||||
|
configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind)
|
||||||
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5)
|
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5)
|
||||||
|
|
||||||
//configuration.put(JSConfigurationKeys.SOURCE_MAP, shouldGenerateSourceMap())
|
//configuration.put(JSConfigurationKeys.SOURCE_MAP, shouldGenerateSourceMap())
|
||||||
@@ -219,13 +229,13 @@ abstract class BasicBoxTest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
val moduleKindString = directives["MODULE_KIND"]
|
val moduleKindMatcher = MODULE_KIND_PATTERN.matcher(text)
|
||||||
if (moduleKindString != null) {
|
if (moduleKindMatcher.find()) {
|
||||||
module.moduleKind = ModuleKind.valueOf(moduleKindString)
|
module.moduleKind = ModuleKind.valueOf(moduleKindMatcher.group(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("NO_INLINE" in directives) {
|
if (NO_INLINE_PATTERN.matcher(text).find()) {
|
||||||
module.inliningDisabled = false
|
module.inliningDisabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +251,7 @@ abstract class BasicBoxTest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
FileUtil.delete(tmpDir);
|
FileUtil.delete(tmpDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,5 +277,8 @@ abstract class BasicBoxTest(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
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")
|
@TestMetadata("js/js.translator/testData/box/operatorOverloading")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@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 AbstractFunctionExpressionTest : JsBasicBoxTest("functionExpression/")
|
||||||
|
|
||||||
abstract class AbstractMultiModuleTest : JsBasicBoxTest("multiModule/")
|
|
||||||
|
|
||||||
abstract class AbstractReservedWordTest : JsBasicBoxTest("reservedWords/")
|
abstract class AbstractReservedWordTest : JsBasicBoxTest("reservedWords/")
|
||||||
|
|
||||||
abstract class AbstractSecondaryConstructorTest : JsBasicBoxTest("secondaryConstructors/")
|
abstract class AbstractSecondaryConstructorTest : JsBasicBoxTest("secondaryConstructors/")
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
package foo
|
||||||
|
|
||||||
|
open class A() {
|
||||||
|
fun f() = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return if ((A().f() + bar.A().f()) == 9) "OK" else "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
package bar
|
||||||
|
|
||||||
|
open class A() {
|
||||||
|
fun f() = 6
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// FILE: a.kt
|
||||||
|
package foo
|
||||||
|
|
||||||
|
open class A() {
|
||||||
|
open fun f() = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
open class C() : B() {
|
||||||
|
override fun f() = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
package foo
|
||||||
|
|
||||||
|
open class B() : A() {
|
||||||
|
override fun f() = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (A().f() != 3) return "fail1"
|
||||||
|
if (B().f() != 4) return "fail2"
|
||||||
|
if (C().f() != 5) return "fail3"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// FILE: a.kt
|
||||||
|
package foo
|
||||||
|
|
||||||
|
fun f() = 3;
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
package foo
|
||||||
|
|
||||||
|
fun box() = if (f() == 3) "OK" else "fail"
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module-1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: AMD
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module-1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: AMD
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: AMD
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: AMD
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module-1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: COMMON_JS
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module-1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: COMMON_JS
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: COMMON_JS
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: COMMON_JS
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module-1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: PLAIN
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module-1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: PLAIN
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: PLAIN
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: PLAIN
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module-1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: UMD
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module-1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: UMD
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// MODULE: module1
|
||||||
|
// FILE: bar.kt
|
||||||
|
// MODULE_KIND: UMD
|
||||||
|
fun bar() = "bar"
|
||||||
|
|
||||||
|
// MODULE: main(module1)
|
||||||
|
// FILE: box.kt
|
||||||
|
// MODULE_KIND: UMD
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("bar", bar())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+3
-3
@@ -7,16 +7,16 @@ class C(val i: Int) : Comparable<C>, A() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ComparableRange<C>.iterator(): Iterator<C> {
|
operator fun ClosedRange<C>.iterator(): Iterator<C> {
|
||||||
var curI: Int = start.i - 1
|
var curI: Int = start.i - 1
|
||||||
|
|
||||||
return object :Iterator<C> {
|
return object : Iterator<C> {
|
||||||
public override fun next(): C {
|
public override fun next(): C {
|
||||||
curI++
|
curI++
|
||||||
return C(curI)
|
return C(curI)
|
||||||
}
|
}
|
||||||
public override fun hasNext(): Boolean {
|
public override fun hasNext(): Boolean {
|
||||||
return curI < end.i
|
return curI <= endInclusive.i
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
open class A() {
|
|
||||||
fun f() = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box() = (A().f() + bar.A().f()) == 9
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package bar
|
|
||||||
|
|
||||||
open class A() {
|
|
||||||
fun f() = 6
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
open class A() {
|
|
||||||
open fun f() = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
open class C() : B() {
|
|
||||||
override fun f() = 5
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
open class B() : A() {
|
|
||||||
override fun f() = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box() = (A().f() == 3) && (B().f() == 4) && (C().f() == 5)
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
fun f() = 3;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
fun box() = (f() == 3)
|
|
||||||
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
module-1->
|
|
||||||
main->module-1
|
|
||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
fun box(): String {
|
|
||||||
assertEquals("bar", bar())
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
js/js.translator/testData/multiModuleWrappers/cases/moduleWithNonIdentifierName/module-1/module-1.kt
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
fun bar() = "bar"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module1->
|
|
||||||
main->module1
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
fun box(): String {
|
|
||||||
assertEquals("bar", bar())
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
fun bar() = "bar"
|
|
||||||
Reference in New Issue
Block a user