Make LineNumberTest auto-generated
This commit is contained in:
+8
-105
@@ -42,7 +42,7 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
public class AbstractLineNumberTest extends TestCaseWithTmpdir {
|
||||
|
||||
private static final String LINE_NUMBER_FUN = "lineNumber";
|
||||
private static final Pattern TEST_LINE_NUMBER_PATTERN = Pattern.compile("^.*test." + LINE_NUMBER_FUN + "\\(\\).*$");
|
||||
@@ -76,7 +76,7 @@ public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
|
||||
@NotNull
|
||||
private JetFile createPsiFile(@NotNull String filename) {
|
||||
File file = new File(getTestDataPath() + "/" + filename);
|
||||
File file = new File(filename);
|
||||
JetCoreEnvironment environment = createEnvironment();
|
||||
|
||||
String text;
|
||||
@@ -132,12 +132,12 @@ public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
return actualLineNumbers;
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(getTestName(true) + ".kt", false);
|
||||
protected void doTest(String path) {
|
||||
doTest(path, false);
|
||||
}
|
||||
|
||||
private void doTestCustom() {
|
||||
doTest("custom/" + getTestName(true) + ".kt", true);
|
||||
protected void doTestCustom(String path) {
|
||||
doTest(path, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -236,106 +236,9 @@ public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void testAnonymousFunction() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassObject() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDefaultParameter() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEnum() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIf() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLocalFunction() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testObject() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPropertyAccessor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPsvm() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTopLevel() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTrait() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTryCatch() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testWhile() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInlineSimpleCall() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCompileTimeConstant() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testIfThen() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testIfThenElse() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testTryCatchExpression() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testTryCatchFinally() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testTryFinally() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testWhen() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testWhenSubject() {
|
||||
doTestCustom();
|
||||
}
|
||||
|
||||
public void testStaticDelegate() {
|
||||
JetFile foo = createPsiFile("staticDelegate/foo.kt");
|
||||
JetFile bar = createPsiFile("staticDelegate/bar.kt");
|
||||
JetFile foo = createPsiFile(getTestDataPath() + "/staticDelegate/foo.kt");
|
||||
JetFile bar = createPsiFile(getTestDataPath() + "/staticDelegate/bar.kt");
|
||||
GenerationState state = GenerationUtils.compileManyFilesGetGenerationStateForTest(foo.getProject(), Arrays.asList(foo, bar));
|
||||
OutputFile file = state.getFactory().get(PackageClassUtils.getPackageClassName(FqName.ROOT) + ".class");
|
||||
assertNotNull(file);
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.jet.codegen;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({LineNumberTestGenerated.LineNumber.class, LineNumberTestGenerated.Custom.class})
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class LineNumberTestGenerated extends AbstractLineNumberTest {
|
||||
@TestMetadata("compiler/testData/lineNumber")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class LineNumber extends AbstractLineNumberTest {
|
||||
public void testAllFilesPresentInLineNumber() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/lineNumber"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction.kt")
|
||||
public void testAnonymousFunction() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/anonymousFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/class.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classObject.kt")
|
||||
public void testClassObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/classObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultParameter.kt")
|
||||
public void testDefaultParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/defaultParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/enum.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/for.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("if.kt")
|
||||
public void testIf() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/if.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimpleCall.kt")
|
||||
public void testInlineSimpleCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/inlineSimpleCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/localFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("object.kt")
|
||||
public void testObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/object.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessor.kt")
|
||||
public void testPropertyAccessor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/propertyAccessor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("psvm.kt")
|
||||
public void testPsvm() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/psvm.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/topLevel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("trait.kt")
|
||||
public void testTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/trait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatch.kt")
|
||||
public void testTryCatch() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/tryCatch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("while.kt")
|
||||
public void testWhile() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/while.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/lineNumber/custom")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Custom extends AbstractLineNumberTest {
|
||||
public void testAllFilesPresentInCustom() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/lineNumber/custom"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("compileTimeConstant.kt")
|
||||
public void testCompileTimeConstant() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/compileTimeConstant.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ifThen.kt")
|
||||
public void testIfThen() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/ifThen.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ifThenElse.kt")
|
||||
public void testIfThenElse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/ifThenElse.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatchExpression.kt")
|
||||
public void testTryCatchExpression() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/tryCatchExpression.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatchFinally.kt")
|
||||
public void testTryCatchFinally() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/tryCatchFinally.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryFinally.kt")
|
||||
public void testTryFinally() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/tryFinally.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/when.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("whenSubject.kt")
|
||||
public void testWhenSubject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/whenSubject.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,7 @@ import org.jetbrains.k2js.test.semantics.AbstractDynamicTest
|
||||
import org.jetbrains.k2js.test.semantics.AbstractMultiModuleTest
|
||||
import org.jetbrains.jet.completion.handlers.AbstractBasicCompletionHandlerTest
|
||||
import org.jetbrains.jet.plugin.decompiler.stubBuilder.AbstractClsStubBuilderTest
|
||||
import org.jetbrains.jet.codegen.AbstractLineNumberTest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -305,6 +306,11 @@ fun main(args: Array<String>) {
|
||||
testClass(javaClass<AbstractJetTypeBindingTest>()) {
|
||||
model("type/binding")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractLineNumberTest>()) {
|
||||
model("lineNumber", recursive = false)
|
||||
model("lineNumber/custom", testMethod = "doTestCustom")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("idea/tests", "idea/testData") {
|
||||
|
||||
Reference in New Issue
Block a user