Add j2k, nj2k performance tests
This commit is contained in:
@@ -30,6 +30,7 @@ dependencies {
|
||||
compile(projectTests(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
compile(projectTests(":kotlinx-serialization-compiler-plugin"))
|
||||
compile(projectTests(":generators:test-generator"))
|
||||
compile(projectTests(":idea"))
|
||||
builtinsCompile("org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion")
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testCompile(builtinsSourceSet.output)
|
||||
|
||||
@@ -105,6 +105,8 @@ import org.jetbrains.kotlin.idea.maven.AbstractKotlinMavenInspectionTest
|
||||
import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest
|
||||
import org.jetbrains.kotlin.idea.navigation.*
|
||||
import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest
|
||||
import org.jetbrains.kotlin.idea.perf.AbstractPerformanceJavaToKotlinCopyPasteConversionTest
|
||||
import org.jetbrains.kotlin.idea.perf.AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest
|
||||
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest
|
||||
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest
|
||||
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest
|
||||
@@ -1171,6 +1173,16 @@ fun main(args: Array<String>) {
|
||||
model("codegen")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("idea/performanceTests", "idea/testData") {
|
||||
testClass<AbstractPerformanceJavaToKotlinCopyPasteConversionTest> {
|
||||
model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""")
|
||||
}
|
||||
|
||||
testClass<AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest> {
|
||||
model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""")
|
||||
}
|
||||
}
|
||||
/*
|
||||
testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") {
|
||||
testClass<AbstractAndroidCompletionTest> {
|
||||
|
||||
@@ -174,6 +174,7 @@ dependencies {
|
||||
|
||||
performanceTestCompile(sourceSets["test"].output)
|
||||
performanceTestCompile(sourceSets["main"].output)
|
||||
performanceTestCompile(project(":nj2k"))
|
||||
performanceTestRuntime(sourceSets["performanceTest"].output)
|
||||
}
|
||||
|
||||
@@ -205,6 +206,8 @@ projectTest(taskName = "performanceTest") {
|
||||
}
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
testsJar {
|
||||
from(sourceSets["performanceTest"].output)
|
||||
}
|
||||
|
||||
configureFormInstrumentation()
|
||||
|
||||
+43
-20
@@ -52,6 +52,8 @@ import org.jetbrains.kotlin.idea.core.util.toPsiFile
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.junit.AfterClass
|
||||
import org.junit.BeforeClass
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
|
||||
@@ -62,7 +64,25 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
private lateinit var jdk18: Sdk
|
||||
private lateinit var myApplication: IdeaTestApplication
|
||||
|
||||
private val stats: Stats = Stats("-perf")
|
||||
companion object {
|
||||
@JvmStatic
|
||||
var warmedUp: Boolean = false
|
||||
|
||||
@JvmStatic
|
||||
val stats: Stats = Stats("-perf")
|
||||
|
||||
@BeforeClass
|
||||
@JvmStatic
|
||||
fun setup() {
|
||||
// things to execute once and keep around for the class
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@JvmStatic
|
||||
fun teardown() {
|
||||
stats.close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
@@ -88,17 +108,22 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = true
|
||||
|
||||
// warm up: open simple small project
|
||||
val project = innerPerfOpenProject("helloKotlin", "warm-up ")
|
||||
val perfHighlightFile = perfHighlightFile(project, "src/HelloMain.kt", "warm-up ")
|
||||
assertTrue("kotlin project has been not imported properly", perfHighlightFile.isNotEmpty())
|
||||
if (!warmedUp) {
|
||||
val project = innerPerfOpenProject("helloKotlin", "warm-up ")
|
||||
val perfHighlightFile = perfHighlightFile(project, "src/HelloMain.kt", "warm-up ")
|
||||
assertTrue("kotlin project has been not imported properly", perfHighlightFile.isNotEmpty())
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
ProjectManagerEx.getInstanceEx().forceCloseProject(project, true)
|
||||
|
||||
ProjectManagerEx.getInstanceEx().forceCloseProject(project, true)
|
||||
warmedUp = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
var runAll = RunAll()
|
||||
|
||||
if (myProject != null) {
|
||||
PsiDocumentManager.getInstance(myProject!!).commitAllDocuments()
|
||||
runAll = runAll
|
||||
.append(ThrowableRunnable { LightPlatformTestCase.doTearDown(myProject!!, myApplication) })
|
||||
}
|
||||
@@ -107,7 +132,7 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
.run()
|
||||
}
|
||||
|
||||
protected fun getTempDirFixture(): TempDirTestFixture {
|
||||
private fun getTempDirFixture(): TempDirTestFixture {
|
||||
val policy = IdeaTestExecutionPolicy.current()
|
||||
return if (policy != null)
|
||||
policy.createTempDirTestFixture()
|
||||
@@ -136,6 +161,8 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
}
|
||||
}
|
||||
}, "change doc $fileName $nameOfChange", "")
|
||||
|
||||
manager.commitAllDocuments()
|
||||
}
|
||||
|
||||
protected fun perfOpenProject(name: String, path: String = "idea/testData/perfTest") {
|
||||
@@ -164,6 +191,8 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
val changeListManagerImpl = ChangeListManager.getInstance(project) as ChangeListManagerImpl
|
||||
changeListManagerImpl.waitUntilRefreshed()
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
|
||||
return project
|
||||
}
|
||||
|
||||
@@ -207,16 +236,6 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
return highlightFile
|
||||
}
|
||||
|
||||
inline fun attempts(block: (v: Int) -> Unit) {
|
||||
attempts(3, block)
|
||||
}
|
||||
|
||||
inline fun attempts(count: Int, block: (v: Int) -> Unit) {
|
||||
for (attempt in 0..count) {
|
||||
block(attempt)
|
||||
}
|
||||
}
|
||||
|
||||
fun perfAutoCompletion(
|
||||
name: String,
|
||||
before: String,
|
||||
@@ -244,10 +263,14 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
|
||||
val actualSuggestions = complete?.map { it.lookupString }?.toList() ?: emptyList()
|
||||
assertTrue(actualSuggestions.containsAll(suggestions.toList()))
|
||||
|
||||
with(fixture) {
|
||||
type(type)
|
||||
checkResult(after)
|
||||
tearDown()
|
||||
try {
|
||||
with(fixture) {
|
||||
type(type)
|
||||
checkResult(after)
|
||||
}
|
||||
} finally {
|
||||
PsiDocumentManager.getInstance(fixture.project).commitAllDocuments()
|
||||
fixture.tearDown()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.idea.perf
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest
|
||||
import org.jetbrains.kotlin.idea.conversion.copy.ConvertJavaCopyPasteProcessor
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractPerformanceJavaToKotlinCopyPasteConversionTest(private val newJ2K: Boolean = false) :
|
||||
AbstractJavaToKotlinCopyPasteConversionTest() {
|
||||
|
||||
private val stats: Stats = Stats("-${j2kPrefix()}-j2k")
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
var warmedUp: Array<Boolean> = arrayOf(false, false)
|
||||
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
Registry.get("kotlin.use.new.j2k").setValue(newJ2K)
|
||||
|
||||
val index = if (newJ2K) 1 else 0
|
||||
if (!warmedUp[index]) {
|
||||
doWarmUpPerfTest()
|
||||
warmedUp[index] = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun doWarmUpPerfTest() {
|
||||
val prefix = j2kPrefix()
|
||||
with(myFixture) {
|
||||
configureByText(JavaFileType.INSTANCE, "<selection>public class Foo {\nprivate String value;\n}</selection>")
|
||||
performEditorAction(IdeActions.ACTION_CUT)
|
||||
configureByText(KotlinFileType.INSTANCE, "<caret>")
|
||||
ConvertJavaCopyPasteProcessor.conversionPerformed = false
|
||||
tcSimplePerfTest("", "warm-up ${prefix} java2kotlin conversion", stats) {
|
||||
performEditorAction(IdeActions.ACTION_PASTE)
|
||||
}
|
||||
}
|
||||
|
||||
kotlin.test.assertFalse(!ConvertJavaCopyPasteProcessor.conversionPerformed, "No conversion to Kotlin suggested")
|
||||
assertEquals("class Foo {\n private val value: String? = null\n}", myFixture.file.text)
|
||||
}
|
||||
|
||||
private fun j2kPrefix(): String {
|
||||
return if (newJ2K) "new" else "old"
|
||||
}
|
||||
|
||||
fun doPerfTest(path: String) {
|
||||
myFixture.testDataPath = testDataPath
|
||||
val testName = getTestName(false)
|
||||
|
||||
myFixture.configureByFiles("$testName.java")
|
||||
|
||||
val fileText = myFixture.editor.document.text
|
||||
val noConversionExpected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// NO_CONVERSION_EXPECTED").isNotEmpty()
|
||||
|
||||
myFixture.performEditorAction(IdeActions.ACTION_COPY)
|
||||
|
||||
configureByDependencyIfExists("$testName.dependency.kt")
|
||||
configureByDependencyIfExists("$testName.dependency.java")
|
||||
|
||||
configureTargetFile("$testName.to.kt")
|
||||
|
||||
ConvertJavaCopyPasteProcessor.conversionPerformed = false
|
||||
|
||||
val prefix = j2kPrefix()
|
||||
|
||||
attempts {
|
||||
tcSimplePerfTest(testName, "${prefix} java2kotlin conversion$it: $testName", stats) {
|
||||
myFixture.performEditorAction(IdeActions.ACTION_PASTE)
|
||||
}
|
||||
|
||||
validate(path, noConversionExpected)
|
||||
|
||||
myFixture.performEditorAction(IdeActions.ACTION_UNDO)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open fun validate(path: String, noConversionExpected: Boolean) {
|
||||
kotlin.test.assertEquals(
|
||||
noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed,
|
||||
if (noConversionExpected) "Conversion to Kotlin should not be suggested" else "No conversion to Kotlin suggested"
|
||||
)
|
||||
KotlinTestUtils.assertEqualsToFile(File(path.replace(".java", ".expected.kt")), myFixture.file.text)
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.idea.perf
|
||||
|
||||
import org.jetbrains.kotlin.idea.conversion.copy.ConvertJavaCopyPasteProcessor
|
||||
|
||||
abstract class AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest :
|
||||
AbstractPerformanceJavaToKotlinCopyPasteConversionTest(newJ2K = true) {
|
||||
|
||||
override fun validate(path: String, noConversionExpected: Boolean) {
|
||||
// nj2k behaves slightly different to classic j2k in cases where conversion is not expected
|
||||
// this is a performance test rather validation test
|
||||
if (!noConversionExpected) {
|
||||
kotlin.test.assertEquals(
|
||||
noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed,
|
||||
if (noConversionExpected) "Conversion to Kotlin should not be suggested" else "No conversion to Kotlin suggested"
|
||||
)
|
||||
}
|
||||
// as well output of nj2k could be slightly different to output of j2k those test data is used
|
||||
}
|
||||
}
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* 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.idea.perf;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
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("idea/testData/copyPaste/conversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class PerformanceJavaToKotlinCopyPasteConversionTestGenerated extends AbstractPerformanceJavaToKotlinCopyPasteConversionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("AddImports.java")
|
||||
public void testAddImports() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImports.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsButNoConversion.java")
|
||||
public void testAddImportsButNoConversion() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsButNoConversion.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsButNoConversion2.java")
|
||||
public void testAddImportsButNoConversion2() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsButNoConversion2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsClassInSamePackage.java")
|
||||
public void testAddImportsClassInSamePackage() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsClassInSamePackage.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsDummyConflict.java")
|
||||
public void testAddImportsDummyConflict() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsDummyConflict.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsWithExplicitImports.java")
|
||||
public void testAddImportsWithExplicitImports() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsWithExplicitImports.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddKClassImport.java")
|
||||
public void testAddKClassImport() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddKClassImport.java");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/copyPaste/conversion"), Pattern.compile("^([^\\.]+)\\.java$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("Arithmetic.java")
|
||||
public void testArithmetic() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Arithmetic.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassWithNoDocComment.java")
|
||||
public void testClassWithNoDocComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ClassWithNoDocComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassWithOverrides.java")
|
||||
public void testClassWithOverrides() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ClassWithOverrides.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Constructor.java")
|
||||
public void testConstructor() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Constructor.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ConversionInCorrectContext.java")
|
||||
public void testConversionInCorrectContext() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ConversionInCorrectContext.java");
|
||||
}
|
||||
|
||||
@TestMetadata("CopyAnnotation.java")
|
||||
public void testCopyAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/CopyAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendsTypeRef.java")
|
||||
public void testExtendsTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ExtendsTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FieldWithNoEndComment.java")
|
||||
public void testFieldWithNoEndComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FieldWithNoEndComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FieldWithNoModifierAndNoSemicolon.java")
|
||||
public void testFieldWithNoModifierAndNoSemicolon() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FieldWithNoModifierAndNoSemicolon.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FileWithNoPackageStatement.java")
|
||||
public void testFileWithNoPackageStatement() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FileWithNoPackageStatement.java");
|
||||
}
|
||||
|
||||
@TestMetadata("HalfTheWhiteSpace.java")
|
||||
public void testHalfTheWhiteSpace() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/HalfTheWhiteSpace.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementsTypeRef.java")
|
||||
public void testImplementsTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ImplementsTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports1.java")
|
||||
public void testImports1() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Imports1.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports2.java")
|
||||
public void testImports2() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Imports2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports3.java")
|
||||
public void testImports3() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Imports3.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Indentation.java")
|
||||
public void testIndentation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Indentation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InsertIntoComment.java")
|
||||
public void testInsertIntoComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/InsertIntoComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InsertIntoString.java")
|
||||
public void testInsertIntoString() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/InsertIntoString.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Kt31848.java")
|
||||
public void testKt31848() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Kt31848.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodDeclarationWithNoBody.java")
|
||||
public void testMethodDeclarationWithNoBody() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodDeclarationWithNoBody.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodReferenceWithoutQualifier.java")
|
||||
public void testMethodReferenceWithoutQualifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodReferenceWithoutQualifier.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodWithNoAnnotation.java")
|
||||
public void testMethodWithNoAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodWithNoAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodWithOnlyOneAnnotation.java")
|
||||
public void testMethodWithOnlyOneAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodWithOnlyOneAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyClosingBrace.java")
|
||||
public void testOnlyClosingBrace() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyClosingBrace.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyOneBraceFromBlock.java")
|
||||
public void testOnlyOneBraceFromBlock() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyOneBraceFromBlock.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyQualifier.java")
|
||||
public void testOnlyQualifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyQualifier.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RawTypeRef.java")
|
||||
public void testRawTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RawTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RedundantTypeCast.java")
|
||||
public void testRedundantTypeCast() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RedundantTypeCast.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RedundantTypeCast2.java")
|
||||
public void testRedundantTypeCast2() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RedundantTypeCast2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SampleBlock.java")
|
||||
public void testSampleBlock() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SampleBlock.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SeveralMethodsSample.java")
|
||||
public void testSeveralMethodsSample() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SeveralMethodsSample.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SingleWordFromIdentifier.java")
|
||||
public void testSingleWordFromIdentifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SingleWordFromIdentifier.java");
|
||||
}
|
||||
}
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* 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.idea.perf;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
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("idea/testData/copyPaste/conversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class PerformanceNewJavaToKotlinCopyPasteConversionTestGenerated extends AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("AddImports.java")
|
||||
public void testAddImports() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImports.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsButNoConversion.java")
|
||||
public void testAddImportsButNoConversion() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsButNoConversion.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsButNoConversion2.java")
|
||||
public void testAddImportsButNoConversion2() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsButNoConversion2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsClassInSamePackage.java")
|
||||
public void testAddImportsClassInSamePackage() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsClassInSamePackage.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsDummyConflict.java")
|
||||
public void testAddImportsDummyConflict() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsDummyConflict.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddImportsWithExplicitImports.java")
|
||||
public void testAddImportsWithExplicitImports() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddImportsWithExplicitImports.java");
|
||||
}
|
||||
|
||||
@TestMetadata("AddKClassImport.java")
|
||||
public void testAddKClassImport() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/AddKClassImport.java");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/copyPaste/conversion"), Pattern.compile("^([^\\.]+)\\.java$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("Arithmetic.java")
|
||||
public void testArithmetic() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Arithmetic.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassWithNoDocComment.java")
|
||||
public void testClassWithNoDocComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ClassWithNoDocComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassWithOverrides.java")
|
||||
public void testClassWithOverrides() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ClassWithOverrides.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Constructor.java")
|
||||
public void testConstructor() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Constructor.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ConversionInCorrectContext.java")
|
||||
public void testConversionInCorrectContext() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ConversionInCorrectContext.java");
|
||||
}
|
||||
|
||||
@TestMetadata("CopyAnnotation.java")
|
||||
public void testCopyAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/CopyAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendsTypeRef.java")
|
||||
public void testExtendsTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ExtendsTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FieldWithNoEndComment.java")
|
||||
public void testFieldWithNoEndComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FieldWithNoEndComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FieldWithNoModifierAndNoSemicolon.java")
|
||||
public void testFieldWithNoModifierAndNoSemicolon() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FieldWithNoModifierAndNoSemicolon.java");
|
||||
}
|
||||
|
||||
@TestMetadata("FileWithNoPackageStatement.java")
|
||||
public void testFileWithNoPackageStatement() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/FileWithNoPackageStatement.java");
|
||||
}
|
||||
|
||||
@TestMetadata("HalfTheWhiteSpace.java")
|
||||
public void testHalfTheWhiteSpace() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/HalfTheWhiteSpace.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementsTypeRef.java")
|
||||
public void testImplementsTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/ImplementsTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports1.java")
|
||||
public void testImports1() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Imports1.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports2.java")
|
||||
public void testImports2() throws Exception {
|
||||
// TODO: commented until rr/darthorimar/range-marker-fix is merged
|
||||
// runTest("idea/testData/copyPaste/conversion/Imports2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Imports3.java")
|
||||
public void testImports3() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Imports3.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Indentation.java")
|
||||
public void testIndentation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Indentation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InsertIntoComment.java")
|
||||
public void testInsertIntoComment() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/InsertIntoComment.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InsertIntoString.java")
|
||||
public void testInsertIntoString() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/InsertIntoString.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Kt31848.java")
|
||||
public void testKt31848() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Kt31848.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodDeclarationWithNoBody.java")
|
||||
public void testMethodDeclarationWithNoBody() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodDeclarationWithNoBody.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodReferenceWithoutQualifier.java")
|
||||
public void testMethodReferenceWithoutQualifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodReferenceWithoutQualifier.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodWithNoAnnotation.java")
|
||||
public void testMethodWithNoAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodWithNoAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodWithOnlyOneAnnotation.java")
|
||||
public void testMethodWithOnlyOneAnnotation() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodWithOnlyOneAnnotation.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyClosingBrace.java")
|
||||
public void testOnlyClosingBrace() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyClosingBrace.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyOneBraceFromBlock.java")
|
||||
public void testOnlyOneBraceFromBlock() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyOneBraceFromBlock.java");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyQualifier.java")
|
||||
public void testOnlyQualifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/OnlyQualifier.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RawTypeRef.java")
|
||||
public void testRawTypeRef() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RawTypeRef.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RedundantTypeCast.java")
|
||||
public void testRedundantTypeCast() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RedundantTypeCast.java");
|
||||
}
|
||||
|
||||
@TestMetadata("RedundantTypeCast2.java")
|
||||
public void testRedundantTypeCast2() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/RedundantTypeCast2.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SampleBlock.java")
|
||||
public void testSampleBlock() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SampleBlock.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SeveralMethodsSample.java")
|
||||
public void testSeveralMethodsSample() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SeveralMethodsSample.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SingleWordFromIdentifier.java")
|
||||
public void testSingleWordFromIdentifier() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/SingleWordFromIdentifier.java");
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,21 @@ inline fun tcSimplePerfTest(file: String, name: String, stats: Stats, block: ()
|
||||
println("##teamcity[buildStatisticValue key='$name' value='$spentMs']")
|
||||
}
|
||||
|
||||
inline fun attempts(block: (v: String) -> Unit) = attempts(3) {
|
||||
block(it)
|
||||
}
|
||||
|
||||
inline fun attempts(count: Int, block: (v: String) -> Unit) {
|
||||
for (attempt in 0..count) {
|
||||
val n = when (attempt) {
|
||||
0 -> ""
|
||||
count -> "N"
|
||||
else -> attempt.toString()
|
||||
}
|
||||
block(n)
|
||||
}
|
||||
}
|
||||
|
||||
fun String.tcEscape(): String {
|
||||
return this
|
||||
.replace("|", "||")
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class Kt31848 {
|
||||
internal fun test() {
|
||||
val list = ArrayList<Int>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<selection>import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Kt31848 {
|
||||
void test(){
|
||||
List list = new ArrayList<Integer>();
|
||||
}
|
||||
}</selection>
|
||||
@@ -0,0 +1 @@
|
||||
<caret>
|
||||
+5
@@ -154,6 +154,11 @@ public class JavaToKotlinCopyPasteConversionTestGenerated extends AbstractJavaTo
|
||||
runTest("idea/testData/copyPaste/conversion/InsertIntoString.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Kt31848.java")
|
||||
public void testKt31848() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/Kt31848.java");
|
||||
}
|
||||
|
||||
@TestMetadata("MethodDeclarationWithNoBody.java")
|
||||
public void testMethodDeclarationWithNoBody() throws Exception {
|
||||
runTest("idea/testData/copyPaste/conversion/MethodDeclarationWithNoBody.java");
|
||||
|
||||
Reference in New Issue
Block a user