JS: introduce a new base class for generated tests
This commit is contained in:
@@ -1141,12 +1141,20 @@ fun main(args: Array<String>) {
|
||||
model("reservedWords/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractFunctionCallableReferenceTest> {
|
||||
model("callableReference/function/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractPropertyCallableReferenceTest> {
|
||||
model("callableReference/property/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractDynamicTest>() {
|
||||
model("dynamic/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractMultiModuleTest>() {
|
||||
model("multiModule/cases", extension = null, recursive =false)
|
||||
model("multiModule/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractInlineJsTest>() {
|
||||
@@ -1162,7 +1170,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractInlineMultiModuleTest>() {
|
||||
model("inlineMultiModule/cases", extension = null, recursive =false)
|
||||
model("inlineMultiModule/cases", extension = null, recursive = false)
|
||||
}
|
||||
|
||||
testClass<AbstractLabelTest>() {
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* 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 com.google.dart.compiler.backend.js.ast.JsProgram
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiManager
|
||||
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.common.output.outputUtils.writeAllTo
|
||||
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.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.js.JavaScript
|
||||
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.config.LibrarySourcesConfig
|
||||
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.test.rhino.RhinoFunctionResultChecker
|
||||
import org.jetbrains.kotlin.js.test.rhino.RhinoUtils
|
||||
import org.jetbrains.kotlin.js.test.utils.DirectiveTestUtils
|
||||
import org.jetbrains.kotlin.js.test.utils.JsTestUtils
|
||||
import org.jetbrains.kotlin.js.test.utils.verifyAst
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils.TestFileFactory
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
|
||||
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 BasicBoxTest(private val relativePathToTestDir: String) : KotlinTestWithEnvironment() {
|
||||
val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
||||
|
||||
private val OUT = "out/"
|
||||
private val COMMON_FILES_DIR = "_commonFiles/"
|
||||
val MODULE_EMULATION_FILE = TEST_DATA_DIR_PATH + "/moduleEmulation.js"
|
||||
|
||||
val TEST_MODULE = "JS_TESTS"
|
||||
val DEFAULT_MODULE = "main"
|
||||
val TEST_FUNCTION = "box"
|
||||
|
||||
fun doTest(filePath: String) {
|
||||
val file = File(filePath)
|
||||
val expectedText = KotlinTestUtils.doLoadFile(file)
|
||||
|
||||
TestFileFactoryImpl().use { testFactory ->
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, expectedText, testFactory)
|
||||
val modules = inputFiles
|
||||
.map { it.module }.distinct()
|
||||
.map { it.name to it }.toMap()
|
||||
|
||||
val orderedModules = DFS.topologicalOrder(modules.values) { module -> module.dependencies.mapNotNull { modules[it] } }
|
||||
|
||||
val generatedJsFiles = orderedModules.asReversed().map { module ->
|
||||
val dependencies = module.dependencies.mapNotNull { modules[it]?.outputFileName + ".meta.js" }
|
||||
|
||||
val outputFileName = module.outputFileName + ".js"
|
||||
generateJavaScriptFile(module, outputFileName, dependencies, modules.size > 1)
|
||||
outputFileName
|
||||
}
|
||||
val mainModule = if (TEST_MODULE in modules) TEST_MODULE else DEFAULT_MODULE
|
||||
|
||||
val checker = RhinoFunctionResultChecker(mainModule, testFactory.testPackage, TEST_FUNCTION, "OK")
|
||||
val globalCommonFiles = JsTestUtils.getFilesInDirectoryByExtension(
|
||||
TEST_DATA_DIR_PATH + COMMON_FILES_DIR, JavaScript.EXTENSION)
|
||||
val localCommonFiles = JsTestUtils.getFilesInDirectoryByExtension(
|
||||
TEST_DATA_DIR_PATH + relativePathToTestDir + COMMON_FILES_DIR, JavaScript.EXTENSION)
|
||||
val inputJsFiles = inputFiles.map { it.fileName }.filter { it.endsWith(".js") }
|
||||
|
||||
val additionalFiles = mutableListOf<String>()
|
||||
if (modules.size > 1) {
|
||||
additionalFiles += MODULE_EMULATION_FILE
|
||||
}
|
||||
val allJsFiles = additionalFiles + inputJsFiles + generatedJsFiles + globalCommonFiles + localCommonFiles
|
||||
|
||||
RhinoUtils.runRhinoTest(allJsFiles, checker)
|
||||
}
|
||||
}
|
||||
|
||||
private val TestModule.outputFileName: String
|
||||
get() {
|
||||
val outputFileSuffix = if (this.name == TEST_MODULE) "" else "-$name"
|
||||
return "$TEST_DATA_DIR_PATH$relativePathToTestDir$OUT" + getTestName(true) + "${outputFileSuffix}_v5"
|
||||
}
|
||||
|
||||
private fun generateJavaScriptFile(module: TestModule, outputFileName: String, dependencies: List<String>, multiModule: Boolean) {
|
||||
val testFiles = module.files.map { it.fileName }.filter { it.endsWith(".kt") }
|
||||
val globalCommonFiles = JsTestUtils.getFilesInDirectoryByExtension(
|
||||
TEST_DATA_DIR_PATH + COMMON_FILES_DIR, KotlinFileType.EXTENSION)
|
||||
val localCommonFiles = JsTestUtils.getFilesInDirectoryByExtension(
|
||||
TEST_DATA_DIR_PATH + relativePathToTestDir + COMMON_FILES_DIR, KotlinFileType.EXTENSION)
|
||||
val psiFiles = createPsiFiles(testFiles + globalCommonFiles + localCommonFiles)
|
||||
|
||||
val config = createConfig(module, dependencies, multiModule)
|
||||
val outputFile = File(outputFileName)
|
||||
|
||||
translateFiles(psiFiles, outputFile, config)
|
||||
}
|
||||
|
||||
protected fun translateFiles(psiFiles: List<KtFile>, outputFile: File, config: JsConfig) {
|
||||
val translator = K2JSTranslator(config)
|
||||
val translationResult = translator.translate(psiFiles, 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)
|
||||
val messages = outputStream.toByteArray().toString(Charset.forName("UTF-8"))
|
||||
throw AssertionError("The following errors occurred compiling test:\n" + messages)
|
||||
}
|
||||
|
||||
val outputFiles = translationResult.getOutputFiles(outputFile, null, null)
|
||||
val outputDir = outputFile.parentFile ?: error("Parent file for output file should not be null, outputFilePath: " + outputFile.path)
|
||||
outputFiles.writeAllTo(outputDir)
|
||||
|
||||
processJsProgram(translationResult.program, psiFiles)
|
||||
}
|
||||
|
||||
protected fun processJsProgram(program: JsProgram, psiFiles: List<KtFile>) {
|
||||
for (file in psiFiles) {
|
||||
val text = file.text
|
||||
DirectiveTestUtils.processDirectives(program, text)
|
||||
}
|
||||
program.verifyAst()
|
||||
}
|
||||
|
||||
private fun createPsiFiles(fileNames: List<String>): List<KtFile> {
|
||||
val psiManager = PsiManager.getInstance(project)
|
||||
val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
|
||||
|
||||
return fileNames.map { fileName -> psiManager.findFile(fileSystem.findFileByPath(fileName)!!) as KtFile }
|
||||
}
|
||||
|
||||
private fun createConfig(module: TestModule, dependencies: List<String>, multiModule: Boolean): JsConfig {
|
||||
val configuration = environment.configuration.copy()
|
||||
|
||||
configuration.put(CommonConfigurationKeys.DISABLE_INLINE, module.inliningDisabled)
|
||||
|
||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + dependencies)
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name)
|
||||
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.v5)
|
||||
|
||||
//configuration.put(JSConfigurationKeys.SOURCE_MAP, shouldGenerateSourceMap())
|
||||
configuration.put(JSConfigurationKeys.META_INFO, multiModule)
|
||||
|
||||
return LibrarySourcesConfig(project, configuration)
|
||||
}
|
||||
|
||||
private inner class TestFileFactoryImpl() : TestFileFactory<TestModule, TestFile>, Closeable {
|
||||
var testPackage: String? = null
|
||||
val tmpDir = KotlinTestUtils.tmpDir("js-tests")
|
||||
val defaultModule = TestModule(TEST_MODULE, emptyList())
|
||||
|
||||
override fun createFile(module: TestModule?, fileName: String, text: String, directives: Map<String, String>): TestFile? {
|
||||
val ktFile = KtPsiFactory(project).createFile(text)
|
||||
val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION }
|
||||
if (boxFunction != null) {
|
||||
testPackage = SingleFileTranslationTest.getPackageName(ktFile)
|
||||
}
|
||||
|
||||
if (module != null) {
|
||||
val moduleKindString = directives["MODULE_KIND"]
|
||||
if (moduleKindString != null) {
|
||||
module.moduleKind = ModuleKind.valueOf(moduleKindString)
|
||||
}
|
||||
|
||||
if ("NO_INLINE" in directives) {
|
||||
module.inliningDisabled = false
|
||||
}
|
||||
}
|
||||
|
||||
val temporaryFile = File(tmpDir, fileName)
|
||||
KotlinTestUtils.mkdirs(temporaryFile.parentFile)
|
||||
temporaryFile.writeText(text, Charsets.UTF_8)
|
||||
|
||||
return TestFile(fileName, temporaryFile.absolutePath, module ?: defaultModule)
|
||||
}
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>): TestModule? {
|
||||
return TestModule(name, dependencies)
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
tmpDir.delete()
|
||||
}
|
||||
}
|
||||
|
||||
private class TestFile(val name: String, val fileName: String, val module: TestModule) {
|
||||
init {
|
||||
module.files += this
|
||||
}
|
||||
}
|
||||
|
||||
private class TestModule(
|
||||
val name: String,
|
||||
dependencies: List<String>
|
||||
) {
|
||||
val dependencies = dependencies.toMutableList()
|
||||
var moduleKind = ModuleKind.PLAIN
|
||||
var inliningDisabled = false
|
||||
val files = mutableListOf<TestFile>()
|
||||
}
|
||||
|
||||
override fun createEnvironment(): KotlinCoreEnvironment {
|
||||
return KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
|
||||
}
|
||||
}
|
||||
-178
@@ -1,178 +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;
|
||||
|
||||
public final class FunctionCallableReferenceTest extends AbstractCallableReferenceTest {
|
||||
|
||||
public FunctionCallableReferenceTest() {
|
||||
super("function/");
|
||||
}
|
||||
|
||||
public void testTopLevelFromClass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTopLevelFromExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTopLevelFromTopLevelStringNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTopLevelFromTopLevelWithArg() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testTopLevelFromTopLevelViaFunCall() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testClassMemberFromClass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberFromExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberFromTopLevelStringNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberFromTopLevelStringOneStringArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberFromTopLevelUnitNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberFromTopLevelUnitOneStringArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromTopLevel() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testExtensionFromClass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromTopLevelStringNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromTopLevelStringOneStringArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromTopLevelUnitNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionFromTopLevelUnitOneStringArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testConstructorFromTopLevelNoArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testConstructorFromTopLevelOneStringArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testConstructorsWithArgs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAbstractClassMember() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberOverridden() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberAndExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClassMemberAndNonExtensionCompatibility() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testLocalAndTopLevelExtensions() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClosureWithSideEffect() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionToPrimitive() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionWithClosure() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testLocalLocal() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testRecursiveClosure() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testUnitWithSideEffect() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleClosure() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleWithArg() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testStringNativeExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
/*
|
||||
public void testBooleanNotIntrinsic() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
*/
|
||||
}
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* 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/callableReference/function/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class FunctionCallableReferenceTestGenerated extends AbstractFunctionCallableReferenceTest {
|
||||
@TestMetadata("abstractClassMember.kt")
|
||||
public void testAbstractClassMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/abstractClassMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/callableReference/function/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberAndExtension.kt")
|
||||
public void testClassMemberAndExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberAndExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberAndNonExtensionCompatibility.kt")
|
||||
public void testClassMemberAndNonExtensionCompatibility() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberAndNonExtensionCompatibility.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromClass.kt")
|
||||
public void testClassMemberFromClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromExtension.kt")
|
||||
public void testClassMemberFromExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromTopLevelStringNoArgs.kt")
|
||||
public void testClassMemberFromTopLevelStringNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromTopLevelStringNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromTopLevelStringOneStringArg.kt")
|
||||
public void testClassMemberFromTopLevelStringOneStringArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromTopLevelStringOneStringArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromTopLevelUnitNoArgs.kt")
|
||||
public void testClassMemberFromTopLevelUnitNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromTopLevelUnitNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberFromTopLevelUnitOneStringArg.kt")
|
||||
public void testClassMemberFromTopLevelUnitOneStringArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberFromTopLevelUnitOneStringArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classMemberOverridden.kt")
|
||||
public void testClassMemberOverridden() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/classMemberOverridden.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("closureWithSideEffect.kt")
|
||||
public void testClosureWithSideEffect() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/closureWithSideEffect.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorFromTopLevelNoArgs.kt")
|
||||
public void testConstructorFromTopLevelNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/constructorFromTopLevelNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorFromTopLevelOneStringArg.kt")
|
||||
public void testConstructorFromTopLevelOneStringArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/constructorFromTopLevelOneStringArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorsWithArgs.kt")
|
||||
public void testConstructorsWithArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/constructorsWithArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extension.kt")
|
||||
public void testExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromClass.kt")
|
||||
public void testExtensionFromClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromExtension.kt")
|
||||
public void testExtensionFromExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromTopLevel.kt")
|
||||
public void testExtensionFromTopLevel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromTopLevel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromTopLevelStringNoArgs.kt")
|
||||
public void testExtensionFromTopLevelStringNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromTopLevelStringNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromTopLevelStringOneStringArg.kt")
|
||||
public void testExtensionFromTopLevelStringOneStringArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromTopLevelStringOneStringArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromTopLevelUnitNoArgs.kt")
|
||||
public void testExtensionFromTopLevelUnitNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromTopLevelUnitNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFromTopLevelUnitOneStringArg.kt")
|
||||
public void testExtensionFromTopLevelUnitOneStringArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionFromTopLevelUnitOneStringArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionToPrimitive.kt")
|
||||
public void testExtensionToPrimitive() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionToPrimitive.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionWithClosure.kt")
|
||||
public void testExtensionWithClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/extensionWithClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localAndTopLevelExtensions.kt")
|
||||
public void testLocalAndTopLevelExtensions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/localAndTopLevelExtensions.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localLocal.kt")
|
||||
public void testLocalLocal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/localLocal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveClosure.kt")
|
||||
public void testRecursiveClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/recursiveClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClosure.kt")
|
||||
public void testSimpleClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/simpleClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWithArg.kt")
|
||||
public void testSimpleWithArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/simpleWithArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("stringNativeExtension.kt")
|
||||
public void testStringNativeExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/stringNativeExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFromClass.kt")
|
||||
public void testTopLevelFromClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/topLevelFromClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFromExtension.kt")
|
||||
public void testTopLevelFromExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/topLevelFromExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFromTopLevelStringNoArgs.kt")
|
||||
public void testTopLevelFromTopLevelStringNoArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/topLevelFromTopLevelStringNoArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFromTopLevelWithArg.kt")
|
||||
public void testTopLevelFromTopLevelWithArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/topLevelFromTopLevelWithArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unitWithSideEffect.kt")
|
||||
public void testUnitWithSideEffect() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/function/cases/unitWithSideEffect.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -32,24 +32,24 @@ import java.util.regex.Pattern;
|
||||
@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("^([^\\.]+)$"), false);
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/multiModule/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("moduleAndVariableNameClash")
|
||||
@TestMetadata("moduleAndVariableNameClash.kt")
|
||||
public void testModuleAndVariableNameClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/moduleAndVariableNameClash/");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/moduleAndVariableNameClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typealiases")
|
||||
@TestMetadata("typealiases.kt")
|
||||
public void testTypealiases() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/typealiases/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("useElementsFromDefaultPackageInAnotherModule")
|
||||
@TestMetadata("useElementsFromDefaultPackageInAnotherModule.kt")
|
||||
public void testUseElementsFromDefaultPackageInAnotherModule() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/useElementsFromDefaultPackageInAnotherModule/");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/multiModule/cases/useElementsFromDefaultPackageInAnotherModule.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
-80
@@ -1,80 +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;
|
||||
|
||||
public class PropertyCallableReferenceTest extends AbstractCallableReferenceTest {
|
||||
|
||||
public PropertyCallableReferenceTest() {
|
||||
super("property/");
|
||||
}
|
||||
|
||||
public void testTopLevelVar() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testExtensionProperty() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testMemberProperty() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAccessViaSubclass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testDelegated() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testDelegatedMutable() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testKClassInstanceIsInitializedFirst() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testOverriddenInSubclass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleMember() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleMutableExtension() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleMutableMember() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleMutableTopLevel() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleTopLevel() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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/callableReference/property/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class PropertyCallableReferenceTestGenerated extends AbstractPropertyCallableReferenceTest {
|
||||
@TestMetadata("accessViaSubclass.kt")
|
||||
public void testAccessViaSubclass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/accessViaSubclass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/callableReference/property/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegated.kt")
|
||||
public void testDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/delegated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedMutable.kt")
|
||||
public void testDelegatedMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/delegatedMutable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/extensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kClassInstanceIsInitializedFirst.kt")
|
||||
public void testKClassInstanceIsInitializedFirst() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/kClassInstanceIsInitializedFirst.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/memberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overriddenInSubclass.kt")
|
||||
public void testOverriddenInSubclass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/overriddenInSubclass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleExtension.kt")
|
||||
public void testSimpleExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleMember.kt")
|
||||
public void testSimpleMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleMutableExtension.kt")
|
||||
public void testSimpleMutableExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleMutableExtension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleMutableMember.kt")
|
||||
public void testSimpleMutableMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleMutableMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleMutableTopLevel.kt")
|
||||
public void testSimpleMutableTopLevel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleMutableTopLevel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleTopLevel.kt")
|
||||
public void testSimpleTopLevel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/simpleTopLevel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelVar.kt")
|
||||
public void testTopLevelVar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/callableReference/property/cases/topLevelVar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
+23
-29
@@ -16,57 +16,51 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics
|
||||
|
||||
import org.jetbrains.kotlin.js.test.AbstractSingleFileTranslationWithDirectivesTest
|
||||
import org.jetbrains.kotlin.js.test.KotlinJSMultiFileTest
|
||||
import org.jetbrains.kotlin.js.test.BasicBoxTest
|
||||
import org.jetbrains.kotlin.js.test.MultipleModulesTranslationTest
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest
|
||||
|
||||
abstract class AbstractBlackBoxTest(d: String) : SingleFileTranslationTest(d) {
|
||||
override fun doTest(filename: String) = checkBlackBoxIsOkByPath(filename)
|
||||
}
|
||||
abstract class AbstractBridgeTest : BasicBoxTest("bridges/")
|
||||
|
||||
abstract class AbstractBridgeTest : AbstractBlackBoxTest("bridges/")
|
||||
abstract class AbstractFunctionCallableReferenceTest : BasicBoxTest("callableReference/function/")
|
||||
|
||||
abstract class AbstractCallableReferenceTest(main: String) : SingleFileTranslationTest("callableReference/" + main)
|
||||
abstract class AbstractPropertyCallableReferenceTest : BasicBoxTest("callableReference/property/")
|
||||
|
||||
abstract class AbstractCompanionObjectTest : SingleFileTranslationTest("objectIntrinsics/")
|
||||
abstract class AbstractCompanionObjectTest : BasicBoxTest("objectIntrinsics/")
|
||||
|
||||
abstract class AbstractDynamicTest : SingleFileTranslationTest("dynamic/")
|
||||
abstract class AbstractDynamicTest : BasicBoxTest("dynamic/")
|
||||
|
||||
abstract class AbstractFunctionExpressionTest : AbstractBlackBoxTest("functionExpression/")
|
||||
abstract class AbstractFunctionExpressionTest : BasicBoxTest("functionExpression/")
|
||||
|
||||
abstract class AbstractInlineEvaluationOrderTest : AbstractSingleFileTranslationWithDirectivesTest("inlineEvaluationOrder/")
|
||||
abstract class AbstractInlineEvaluationOrderTest : BasicBoxTest("inlineEvaluationOrder/")
|
||||
|
||||
abstract class AbstractInlineJsStdlibTest : AbstractSingleFileTranslationWithDirectivesTest("inlineStdlib/")
|
||||
abstract class AbstractInlineJsStdlibTest : BasicBoxTest("inlineStdlib/")
|
||||
|
||||
abstract class AbstractInlineJsTest : AbstractSingleFileTranslationWithDirectivesTest("inline/")
|
||||
abstract class AbstractInlineJsTest : BasicBoxTest("inline/")
|
||||
|
||||
abstract class AbstractJsCodeTest : AbstractSingleFileTranslationWithDirectivesTest("jsCode/")
|
||||
abstract class AbstractJsCodeTest : BasicBoxTest("jsCode/")
|
||||
|
||||
abstract class AbstractLabelTest : AbstractSingleFileTranslationWithDirectivesTest("labels/")
|
||||
abstract class AbstractLabelTest : BasicBoxTest("labels/")
|
||||
|
||||
abstract class AbstractMultiModuleTest : MultipleModulesTranslationTest("multiModule/")
|
||||
abstract class AbstractMultiModuleTest : BasicBoxTest("multiModule/")
|
||||
|
||||
abstract class AbstractInlineMultiModuleTest : MultipleModulesTranslationTest("inlineMultiModule/")
|
||||
|
||||
abstract class AbstractReservedWordTest : SingleFileTranslationTest("reservedWords/")
|
||||
abstract class AbstractReservedWordTest : BasicBoxTest("reservedWords/")
|
||||
|
||||
abstract class AbstractSecondaryConstructorTest : AbstractBlackBoxTest("secondaryConstructors/")
|
||||
abstract class AbstractSecondaryConstructorTest : BasicBoxTest("secondaryConstructors/")
|
||||
|
||||
abstract class AbstractInnerNestedTest : AbstractBlackBoxTest("innerNested/")
|
||||
abstract class AbstractInnerNestedTest : BasicBoxTest("innerNested/")
|
||||
|
||||
abstract class AbstractClassesTest : AbstractBlackBoxTest("classes/")
|
||||
abstract class AbstractClassesTest : BasicBoxTest("classes/")
|
||||
|
||||
abstract class AbstractSuperTest : AbstractBlackBoxTest("super/")
|
||||
abstract class AbstractSuperTest : BasicBoxTest("super/")
|
||||
|
||||
abstract class AbstractLocalClassesTest : AbstractBlackBoxTest("localClasses/")
|
||||
abstract class AbstractLocalClassesTest : BasicBoxTest("localClasses/")
|
||||
|
||||
abstract class AbstractNonLocalReturnsTest : KotlinJSMultiFileTest("inline.generated/nonLocalReturns/")
|
||||
abstract class AbstractNonLocalReturnsTest : BasicBoxTest("inline.generated/nonLocalReturns/")
|
||||
|
||||
abstract class AbstractRttiTest : SingleFileTranslationTest("rtti/")
|
||||
abstract class AbstractRttiTest : BasicBoxTest("rtti/")
|
||||
|
||||
abstract class AbstractCastTest : SingleFileTranslationTest("expression/cast/")
|
||||
abstract class AbstractCastTest : BasicBoxTest("expression/cast/")
|
||||
|
||||
abstract class AbstractLightReflectionTest : SingleFileTranslationTest("reflection/light/")
|
||||
|
||||
abstract class AbstractTypeAliasesTests : AbstractBlackBoxTest("typealiases/")
|
||||
abstract class AbstractLightReflectionTest : BasicBoxTest("reflection/light/")
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
if ((Boolean::not)(true) != false) return "Fail 1"
|
||||
if ((Boolean::not)(false) != true) return "Fail 2"
|
||||
return "OK"
|
||||
}
|
||||
+5
-3
@@ -14,12 +14,14 @@ fun A.bar(x: Int): Int {
|
||||
return x
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
val funRef = A::bar
|
||||
val obj = A()
|
||||
var result = funRef(obj, 25)
|
||||
if (result != 25 || obj.xx != 200) return false
|
||||
if (result != 25 || obj.xx != 200) return "fail1: result = $result, expected 25; obj.xx = $obj.xx, expected 200"
|
||||
|
||||
result = run(A(), 25, funRef)
|
||||
return result == 25 && obj.xx == 200
|
||||
if (result != 25 || obj.xx != 200) return "fail2: result = $result, expected 25; obj.xx = $obj.xx, expected 200"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
|
||||
package foo
|
||||
|
||||
fun run(arg: Int, funRef:(Int) -> Int): Int {
|
||||
return funRef(arg)
|
||||
}
|
||||
|
||||
fun inc(x: Int) = x + 1
|
||||
|
||||
fun tmp():Function1<Int, Int> {
|
||||
return ::inc
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
if (tmp()(5) != 6) return false
|
||||
|
||||
if (run(5, tmp()) != 6) return false
|
||||
|
||||
return true
|
||||
}
|
||||
+5
-5
@@ -6,13 +6,13 @@ fun run(arg: Int, funRef:(Int) -> Int): Int {
|
||||
}
|
||||
fun inc(x: Int) = x + 1
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
val funRef = ::inc
|
||||
if (funRef(5) != 6) return false
|
||||
if (funRef(5) != 6) return "fail1"
|
||||
|
||||
if (run(5, funRef) != 6) return false
|
||||
if (run(5, funRef) != 6) return "fail2"
|
||||
|
||||
if (run(5) {x -> x + 1} != 6) return false
|
||||
if (run(5) {x -> x + 1} != 6) return "fail3"
|
||||
|
||||
return true
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
function B() {
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FILE: is.kt
|
||||
package foo
|
||||
|
||||
class A
|
||||
@@ -15,4 +16,8 @@ fun box(): String {
|
||||
testFalse { b is A }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: is.js
|
||||
function B() {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// MODULE: main(module1)
|
||||
// FILE: main.kt
|
||||
|
||||
fun box(): String {
|
||||
var module1 = bar()
|
||||
assertEquals("bar", module1)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1.kt
|
||||
|
||||
fun bar() = "bar"
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
module1->
|
||||
main->module1
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
fun box(): String {
|
||||
var module1 = bar()
|
||||
assertEquals("bar", module1)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
fun bar() = "bar"
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: main(module1)
|
||||
// FILE: main.kt
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals("A: invoked from module", f("A"))
|
||||
assertEquals(10, A(10).x)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1.kt
|
||||
|
||||
public fun f(s: String): String = "${s}: invoked from module"
|
||||
|
||||
public class A(val x: Int)
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
module1->
|
||||
main->module1
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
|
||||
assertEquals("A: invoked from module", f("A"))
|
||||
assertEquals(10, A(10).x)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
public fun f(s: String): String = "${s}: invoked from module"
|
||||
|
||||
public class A(val x: Int)
|
||||
Reference in New Issue
Block a user