KT-11030 Borrow test for local classes from JVM backend
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
// TODO: Enable when JS backend supports local classes
|
|
||||||
// TARGET_BACKEND: JVM
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
val o = object {
|
val o = object {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// TODO: Enable when JS backend get support of local classes
|
|
||||||
// TARGET_BACKEND: JVM
|
|
||||||
fun test1(str: String): String {
|
fun test1(str: String): String {
|
||||||
data class A(val x: Int) {
|
data class A(val x: Int) {
|
||||||
fun foo() = str
|
fun foo() = str
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// TODO: Enable for JS when it supports local classes.
|
|
||||||
// TARGET_BACKEND: JVM
|
|
||||||
|
|
||||||
fun testFun1(str: String): String {
|
fun testFun1(str: String): String {
|
||||||
val capture = str
|
val capture = str
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// TODO: enable when JS backend gets support of local classes
|
|
||||||
// TARGET_BACKEND: JVM
|
|
||||||
|
|
||||||
open class C(s: Int) {
|
open class C(s: Int) {
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|
||||||
|
|||||||
@@ -1100,6 +1100,10 @@ fun main(args: Array<String>) {
|
|||||||
model("codegen/box/super/", targetBackend = TargetBackend.JS)
|
model("codegen/box/super/", targetBackend = TargetBackend.JS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractLocalClassesTest>() {
|
||||||
|
model("codegen/box/localClasses/", targetBackend = TargetBackend.JS)
|
||||||
|
}
|
||||||
|
|
||||||
testClass<AbstractNonLocalReturnsTest>() {
|
testClass<AbstractNonLocalReturnsTest>() {
|
||||||
model("codegen/boxInline/nonLocalReturns/", targetBackend = TargetBackend.JS)
|
model("codegen/boxInline/nonLocalReturns/", targetBackend = TargetBackend.JS)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,6 @@ import java.util.regex.Pattern;
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class ClassesTestGenerated extends AbstractClassesTest {
|
public class ClassesTestGenerated extends AbstractClassesTest {
|
||||||
@TestMetadata("classCompanionInitializationWithJava.kt")
|
|
||||||
public void ignoredClassCompanionInitializationWithJava() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classCompanionInitializationWithJava.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("classObjectAsStaticInitializer.kt")
|
@TestMetadata("classObjectAsStaticInitializer.kt")
|
||||||
public void ignoredClassObjectAsStaticInitializer() throws Exception {
|
public void ignoredClassObjectAsStaticInitializer() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classObjectAsStaticInitializer.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classObjectAsStaticInitializer.kt");
|
||||||
@@ -91,42 +85,18 @@ public class ClassesTestGenerated extends AbstractClassesTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2607.kt")
|
|
||||||
public void ignoredKt2607() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt2607.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("kt508.kt")
|
@TestMetadata("kt508.kt")
|
||||||
public void ignoredKt508() throws Exception {
|
public void ignoredKt508() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt508.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt508.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5347.kt")
|
|
||||||
public void ignoredKt5347() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt5347.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("kt707.kt")
|
@TestMetadata("kt707.kt")
|
||||||
public void ignoredKt707() throws Exception {
|
public void ignoredKt707() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt707.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt707.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8011.kt")
|
|
||||||
public void ignoredKt8011() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt8011.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("kt8011a.kt")
|
|
||||||
public void ignoredKt8011a() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt8011a.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInClasses() throws Exception {
|
public void testAllFilesPresentInClasses() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/classes"), Pattern.compile("^(.+)\\.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/classes"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
@@ -461,6 +431,12 @@ public class ClassesTestGenerated extends AbstractClassesTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2607.kt")
|
||||||
|
public void testKt2607() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt2607.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2626.kt")
|
@TestMetadata("kt2626.kt")
|
||||||
public void testKt2626() throws Exception {
|
public void testKt2626() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt2626.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt2626.kt");
|
||||||
@@ -557,6 +533,12 @@ public class ClassesTestGenerated extends AbstractClassesTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt5347.kt")
|
||||||
|
public void testKt5347() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt5347.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6136.kt")
|
@TestMetadata("kt6136.kt")
|
||||||
public void testKt6136() throws Exception {
|
public void testKt6136() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt6136.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt6136.kt");
|
||||||
@@ -587,6 +569,12 @@ public class ClassesTestGenerated extends AbstractClassesTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt8011a.kt")
|
||||||
|
public void testKt8011a() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt8011a.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt903.kt")
|
@TestMetadata("kt903.kt")
|
||||||
public void testKt903() throws Exception {
|
public void testKt903() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt903.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt903.kt");
|
||||||
|
|||||||
+169
@@ -0,0 +1,169 @@
|
|||||||
|
/*
|
||||||
|
* 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("compiler/testData/codegen/box/localClasses")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public class LocalClassesTestGenerated extends AbstractLocalClassesTest {
|
||||||
|
public void testAllFilesPresentInLocalClasses() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anonymousObjectInInitializer.kt")
|
||||||
|
public void testAnonymousObjectInInitializer() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/anonymousObjectInInitializer.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anonymousObjectInParameterInitializer.kt")
|
||||||
|
public void testAnonymousObjectInParameterInitializer() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/anonymousObjectInParameterInitializer.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inExtensionFunction.kt")
|
||||||
|
public void testInExtensionFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionFunction.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inExtensionProperty.kt")
|
||||||
|
public void testInExtensionProperty() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionProperty.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inLocalExtensionFunction.kt")
|
||||||
|
public void testInLocalExtensionFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inLocalExtensionFunction.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inLocalExtensionProperty.kt")
|
||||||
|
public void testInLocalExtensionProperty() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inLocalExtensionProperty.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassInLocalClass.kt")
|
||||||
|
public void testInnerClassInLocalClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/innerClassInLocalClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerOfLocalCaptureExtensionReceiver.kt")
|
||||||
|
public void testInnerOfLocalCaptureExtensionReceiver() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/innerOfLocalCaptureExtensionReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2700.kt")
|
||||||
|
public void testKt2700() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt2700.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt2873.kt")
|
||||||
|
public void testKt2873() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt2873.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt3210.kt")
|
||||||
|
public void testKt3210() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt3210.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt3389.kt")
|
||||||
|
public void testKt3389() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt3389.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt3584.kt")
|
||||||
|
public void testKt3584() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt3584.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt4174.kt")
|
||||||
|
public void testKt4174() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/kt4174.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localClass.kt")
|
||||||
|
public void testLocalClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/localClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localClassCaptureExtensionReceiver.kt")
|
||||||
|
public void testLocalClassCaptureExtensionReceiver() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/localClassCaptureExtensionReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localClassInInitializer.kt")
|
||||||
|
public void testLocalClassInInitializer() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/localClassInInitializer.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localClassInParameterInitializer.kt")
|
||||||
|
public void testLocalClassInParameterInitializer() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/localClassInParameterInitializer.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localExtendsInnerAndReferencesOuterMember.kt")
|
||||||
|
public void testLocalExtendsInnerAndReferencesOuterMember() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/localExtendsInnerAndReferencesOuterMember.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noclosure.kt")
|
||||||
|
public void testNoclosure() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/noclosure.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("object.kt")
|
||||||
|
public void testObject() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/object.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("withclosure.kt")
|
||||||
|
public void testWithclosure() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/withclosure.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,12 +31,6 @@ import java.util.regex.Pattern;
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class SuperTestGenerated extends AbstractSuperTest {
|
public class SuperTestGenerated extends AbstractSuperTest {
|
||||||
@TestMetadata("kt4173_3.kt")
|
|
||||||
public void ignoredKt4173_3() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt4173_3.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInSuper() throws Exception {
|
public void testAllFilesPresentInSuper() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/super"), Pattern.compile("^(.+)\\.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/super"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
@@ -143,6 +137,12 @@ public class SuperTestGenerated extends AbstractSuperTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt4173_3.kt")
|
||||||
|
public void testKt4173_3() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt4173_3.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4982.kt")
|
@TestMetadata("kt4982.kt")
|
||||||
public void testKt4982() throws Exception {
|
public void testKt4982() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt4982.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt4982.kt");
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -58,4 +58,6 @@ abstract class AbstractClassesTest : AbstractBlackBoxTest("classes/")
|
|||||||
|
|
||||||
abstract class AbstractSuperTest : AbstractBlackBoxTest("super/")
|
abstract class AbstractSuperTest : AbstractBlackBoxTest("super/")
|
||||||
|
|
||||||
|
abstract class AbstractLocalClassesTest : AbstractBlackBoxTest("localClasses/")
|
||||||
|
|
||||||
abstract class AbstractNonLocalReturnsTest : KotlinJSMultiFileTest("inline.generated/nonLocalReturns/")
|
abstract class AbstractNonLocalReturnsTest : KotlinJSMultiFileTest("inline.generated/nonLocalReturns/")
|
||||||
|
|||||||
Reference in New Issue
Block a user