add local variable test. This test runs box() method and checks local variable types and names avaiable at every step.

This commit is contained in:
Jiaxiang Chen
2019-10-21 17:29:04 -07:00
committed by Ilmir Usmanov
parent 6b73ef4b0b
commit 6454cfad87
11 changed files with 355 additions and 4 deletions
@@ -0,0 +1,63 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.debugInformation;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.Test;
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/debug/localVariables")
@TestDataPath("$PROJECT_ROOT")
@RunWith(BlockJUnit4ClassRunner.class)
public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
@Test
public void testAllFilesPresentInLocalVariables() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/debug/localVariables"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("copyFunction.kt")
public void testCopyFunction() throws Exception {
runTest("compiler/testData/debug/localVariables/copyFunction.kt");
}
@Test
@TestMetadata("destructuringInFor.kt")
public void testDestructuringInFor() throws Exception {
runTest("compiler/testData/debug/localVariables/destructuringInFor.kt");
}
@Test
@TestMetadata("destructuringInLambdas.kt")
public void testDestructuringInLambdas() throws Exception {
runTest("compiler/testData/debug/localVariables/destructuringInLambdas.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("compiler/testData/debug/localVariables/localFun.kt");
}
@Test
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
runTest("compiler/testData/debug/localVariables/underscoreNames.kt");
}
}
@@ -0,0 +1,63 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.debugInformation;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.Test;
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/debug/localVariables")
@TestDataPath("$PROJECT_ROOT")
@RunWith(BlockJUnit4ClassRunner.class)
public class LocalVariableTestGenerated extends AbstractLocalVariableTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@Test
public void testAllFilesPresentInLocalVariables() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/debug/localVariables"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@Test
@TestMetadata("copyFunction.kt")
public void testCopyFunction() throws Exception {
runTest("compiler/testData/debug/localVariables/copyFunction.kt");
}
@Test
@TestMetadata("destructuringInFor.kt")
public void testDestructuringInFor() throws Exception {
runTest("compiler/testData/debug/localVariables/destructuringInFor.kt");
}
@Test
@TestMetadata("destructuringInLambdas.kt")
public void testDestructuringInLambdas() throws Exception {
runTest("compiler/testData/debug/localVariables/destructuringInLambdas.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("compiler/testData/debug/localVariables/localFun.kt");
}
@Test
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
runTest("compiler/testData/debug/localVariables/underscoreNames.kt");
}
}
@@ -14,7 +14,9 @@ import org.jetbrains.kotlin.checkers.*
import org.jetbrains.kotlin.checkers.javac.*
import org.jetbrains.kotlin.cli.AbstractCliTest
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrLocalVariableTest
import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrSteppingTest
import org.jetbrains.kotlin.codegen.debugInformation.AbstractLocalVariableTest
import org.jetbrains.kotlin.codegen.debugInformation.AbstractSteppingTest
import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest
import org.jetbrains.kotlin.codegen.flags.AbstractWriteFlagsTest
@@ -373,6 +375,10 @@ fun main(args: Array<String>) {
model("debug/stepping", targetBackend = TargetBackend.JVM)
}
testClass<AbstractLocalVariableTest>(useJunit4 = true) {
model("debug/localVariables", targetBackend = TargetBackend.JVM)
}
testClass<AbstractLocalClassProtoTest> {
model("serialization/local")
}
@@ -466,6 +472,10 @@ fun main(args: Array<String>) {
model("debug/stepping", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrLocalVariableTest>(useJunit4 = true) {
model("debug/localVariables", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrBlackBoxInlineCodegenTest> {
model("codegen/boxInline", targetBackend = TargetBackend.JVM_IR)
}