JS: prepare tests for secondary constructors

This commit is contained in:
Zalim Bashorov
2015-05-22 18:33:38 +03:00
parent 72c2648fc8
commit dc1b91eacd
7 changed files with 171 additions and 2 deletions
@@ -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) {
@@ -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) {
@@ -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 = ""
@@ -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 {
@@ -169,7 +169,7 @@ fun main(args: Array<String>) {
model("parseCodeFragment/block", testMethod = "doBlockCodeFragmentParsingTest", extension = "kt")
}
GenerateRangesCodegenTestData.main(array<String>())
GenerateRangesCodegenTestData.main(arrayOf<String>())
testClass(javaClass<AbstractBlackBoxCodegenTest>()) {
model("codegen/box")
@@ -893,13 +893,17 @@ fun main(args: Array<String>) {
model("codegen/box/functions/functionExpression", targetBackend = TargetBackend.JS)
}
testClass(javaClass<AbstractSecondaryConstructorTest>()) {
model("codegen/box/secondaryConstructors", targetBackend = TargetBackend.JS)
}
}
}
private class TestGroup(val testsRoot: String, val testDataRoot: String) {
inline fun <reified T: TestCase> testClass(
suiteTestClass: String = getDefaultSuiteTestClass(javaClass<T>()),
[noinline] init: TestClass.() -> Unit
@noinline init: TestClass.() -> Unit
) {
testClass(javaClass<T>(), suiteTestClass, init)
}
@@ -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);
}
}
@@ -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/")