diff --git a/compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt b/compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt index 9d0851c426b..e4abfb6eeb7 100644 --- a/compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt +++ b/compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt @@ -1,3 +1,6 @@ +// TODO enable for JS backend too when KT-4124 will be fixed +// TARGET_BACKEND: JVM + class Outer { val outerProp: String constructor(x: String) { diff --git a/compiler/testData/codegen/box/secondaryConstructors/innerClassesInheritance.kt b/compiler/testData/codegen/box/secondaryConstructors/innerClassesInheritance.kt index f68b538d5ef..5aaf8f6d88e 100644 --- a/compiler/testData/codegen/box/secondaryConstructors/innerClassesInheritance.kt +++ b/compiler/testData/codegen/box/secondaryConstructors/innerClassesInheritance.kt @@ -1,3 +1,6 @@ +// TODO enable for JS backend too when KT-4124 will be fixed +// TARGET_BACKEND: JVM + class Outer { val outerProp: String constructor(x: String) { diff --git a/compiler/testData/codegen/box/secondaryConstructors/localClasses.kt b/compiler/testData/codegen/box/secondaryConstructors/localClasses.kt index fb26a6ba6aa..31c83c1b990 100644 --- a/compiler/testData/codegen/box/secondaryConstructors/localClasses.kt +++ b/compiler/testData/codegen/box/secondaryConstructors/localClasses.kt @@ -1,3 +1,6 @@ +// TODO enable for JS backend too when KT-4124 will be fixed +// TARGET_BACKEND: JVM + open class C(val grandParentProp: String) fun box(): String { var sideEffects: String = "" diff --git a/compiler/testData/codegen/box/secondaryConstructors/withNonLocalReturn.kt b/compiler/testData/codegen/box/secondaryConstructors/withNonLocalReturn.kt index 0b0be6bbbac..6e1954f99c6 100644 --- a/compiler/testData/codegen/box/secondaryConstructors/withNonLocalReturn.kt +++ b/compiler/testData/codegen/box/secondaryConstructors/withNonLocalReturn.kt @@ -1,3 +1,6 @@ +// TODO enable for JS backend too when KT-7819 will be fixed +// TARGET_BACKEND: JVM + inline fun run(block: () -> Unit) = block() class A { diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 973974a37d2..ba1239709cb 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -169,7 +169,7 @@ fun main(args: Array) { model("parseCodeFragment/block", testMethod = "doBlockCodeFragmentParsingTest", extension = "kt") } - GenerateRangesCodegenTestData.main(array()) + GenerateRangesCodegenTestData.main(arrayOf()) testClass(javaClass()) { model("codegen/box") @@ -893,13 +893,17 @@ fun main(args: Array) { model("codegen/box/functions/functionExpression", targetBackend = TargetBackend.JS) } + testClass(javaClass()) { + model("codegen/box/secondaryConstructors", targetBackend = TargetBackend.JS) + } + } } private class TestGroup(val testsRoot: String, val testDataRoot: String) { inline fun testClass( suiteTestClass: String = getDefaultSuiteTestClass(javaClass()), - [noinline] init: TestClass.() -> Unit + @noinline init: TestClass.() -> Unit ) { testClass(javaClass(), suiteTestClass, init) } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/SecondaryConstructorTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/SecondaryConstructorTestGenerated.java new file mode 100644 index 00000000000..19263d96f55 --- /dev/null +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/SecondaryConstructorTestGenerated.java @@ -0,0 +1,151 @@ +/* + * 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 com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.JetTestUtils; +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/secondaryConstructors") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class SecondaryConstructorTestGenerated extends AbstractSecondaryConstructorTest { + @TestMetadata("innerClasses.kt") + public void ignoredInnerClasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt"); + doTest(fileName); + } + + @TestMetadata("innerClassesInheritance.kt") + public void ignoredInnerClassesInheritance() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/innerClassesInheritance.kt"); + doTest(fileName); + } + + @TestMetadata("localClasses.kt") + public void ignoredLocalClasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/localClasses.kt"); + doTest(fileName); + } + + @TestMetadata("withNonLocalReturn.kt") + public void ignoredWithNonLocalReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withNonLocalReturn.kt"); + doTest(fileName); + } + + @TestMetadata("accessToCompanion.kt") + public void testAccessToCompanion() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/accessToCompanion.kt"); + doTest(fileName); + } + + public void testAllFilesPresentInSecondaryConstructors() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("basicNoPrimaryManySinks.kt") + public void testBasicNoPrimaryManySinks() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/basicNoPrimaryManySinks.kt"); + doTest(fileName); + } + + @TestMetadata("basicNoPrimaryOneSink.kt") + public void testBasicNoPrimaryOneSink() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/basicNoPrimaryOneSink.kt"); + doTest(fileName); + } + + @TestMetadata("basicPrimary.kt") + public void testBasicPrimary() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/basicPrimary.kt"); + doTest(fileName); + } + + @TestMetadata("clashingDefaultConstructors.kt") + public void testClashingDefaultConstructors() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/clashingDefaultConstructors.kt"); + doTest(fileName); + } + + @TestMetadata("dataClasses.kt") + public void testDataClasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/dataClasses.kt"); + doTest(fileName); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/defaultArgs.kt"); + doTest(fileName); + } + + @TestMetadata("delegationWithPrimary.kt") + public void testDelegationWithPrimary() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/delegationWithPrimary.kt"); + doTest(fileName); + } + + @TestMetadata("enums.kt") + public void testEnums() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/enums.kt"); + doTest(fileName); + } + + @TestMetadata("generics.kt") + public void testGenerics() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/generics.kt"); + doTest(fileName); + } + + @TestMetadata("superCallPrimary.kt") + public void testSuperCallPrimary() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/superCallPrimary.kt"); + doTest(fileName); + } + + @TestMetadata("superCallSecondary.kt") + public void testSuperCallSecondary() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/superCallSecondary.kt"); + doTest(fileName); + } + + @TestMetadata("varargs.kt") + public void testVarargs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/varargs.kt"); + doTest(fileName); + } + + @TestMetadata("withReturn.kt") + public void testWithReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withReturn.kt"); + doTest(fileName); + } + + @TestMetadata("withReturnUnit.kt") + public void testWithReturnUnit() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withReturnUnit.kt"); + doTest(fileName); + } +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/abstractClassesForGeneratedTests.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/abstractClassesForGeneratedTests.kt index 0a527e2c870..b603ceda4cf 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/abstractClassesForGeneratedTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/abstractClassesForGeneratedTests.kt @@ -49,3 +49,5 @@ public abstract class AbstractMultiModuleTest : MultipleModulesTranslationTest(" public abstract class AbstractInlineMultiModuleTest : MultipleModulesTranslationTest("inlineMultiModule/") public abstract class AbstractReservedWordTest : SingleFileTranslationTest("reservedWords/") + +public abstract class AbstractSecondaryConstructorTest : AbstractBlackBoxTest("secondaryConstructors/")