Add highlight and completion performance tests

This commit is contained in:
Vladimir Dolzhenko
2019-06-21 13:13:19 +02:00
parent 4531d2a7b4
commit ccfe155f58
20 changed files with 3210 additions and 324 deletions
@@ -105,8 +105,7 @@ import org.jetbrains.kotlin.idea.maven.AbstractKotlinMavenInspectionTest
import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest
import org.jetbrains.kotlin.idea.navigation.* import org.jetbrains.kotlin.idea.navigation.*
import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest
import org.jetbrains.kotlin.idea.perf.AbstractPerformanceJavaToKotlinCopyPasteConversionTest import org.jetbrains.kotlin.idea.perf.*
import org.jetbrains.kotlin.idea.perf.AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest
@@ -1186,6 +1185,33 @@ fun main(args: Array<String>) {
testClass<AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest> { testClass<AbstractPerformanceNewJavaToKotlinCopyPasteConversionTest> {
model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""") model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""")
} }
testClass<AbstractPerformanceHighlightingTest> {
model("highlighter", testMethod = "doPerfTest")
}
}
testGroup("idea/performanceTests", "idea/idea-completion/testData") {
testClass<AbstractPerformanceCompletionIncrementalResolveTest> {
model("incrementalResolve", testMethod = "doPerfTest")
}
testClass<AbstractPerformanceBasicCompletionHandlerTest> {
model("handlers/basic", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
testClass<AbstractPerformanceSmartCompletionHandlerTest> {
model("handlers/smart", testMethod = "doPerfTest")
}
testClass<AbstractPerformanceKeywordCompletionHandlerTest> {
model("handlers/keywords", testMethod = "doPerfTest")
}
testClass<AbstractPerformanceCompletionCharFilterTest> {
model("handlers/charFilter", testMethod = "doPerfTest")
}
} }
/* /*
testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") { testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") {
@@ -40,7 +40,7 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa
fixture.checkResultByFile(afterFilePath) fixture.checkResultByFile(afterFilePath)
} }
private fun getExistentLookupElement(lookupString: String?, itemText: String?, tailText: String?): LookupElement? { protected fun getExistentLookupElement(lookupString: String?, itemText: String?, tailText: String?): LookupElement? {
val lookup = LookupManager.getInstance(project)?.activeLookup as LookupImpl? ?: return null val lookup = LookupManager.getInstance(project)?.activeLookup as LookupImpl? ?: return null
val items = lookup.items val items = lookup.items
@@ -0,0 +1,177 @@
/*
* 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.completion.test.handlers.CompletionHandlerTestBase
import com.intellij.application.options.CodeStyle
import com.intellij.codeInsight.completion.CompletionType
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
import org.jetbrains.kotlin.idea.completion.test.configureWithExtraFile
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
import org.jetbrains.kotlin.idea.test.rollbackCompilerOptions
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.utils.addToStdlib.indexOfOrNull
import org.junit.AfterClass
import java.io.File
/**
* inspired by @see AbstractCompletionHandlerTest
*/
abstract class AbstractPerformanceCompletionHandlerTests(
private val defaultCompletionType: CompletionType,
private val note: String = ""
) : CompletionHandlerTestBase() {
private val INVOCATION_COUNT_PREFIX = "INVOCATION_COUNT:"
private val LOOKUP_STRING_PREFIX = "ELEMENT:"
private val ELEMENT_TEXT_PREFIX = "ELEMENT_TEXT:"
private val TAIL_TEXT_PREFIX = "TAIL_TEXT:"
private val COMPLETION_CHAR_PREFIX = "CHAR:"
private val CODE_STYLE_SETTING_PREFIX = "CODE_STYLE_SETTING:"
companion object {
@JvmStatic
val statsMap: MutableMap<String, Stats> = mutableMapOf()
@AfterClass
@JvmStatic
fun teardown() {
statsMap.values.forEach { it.close() }
}
}
private fun stats(): Stats {
val suffix = "${defaultCompletionType.toString().toLowerCase()}${if (note.isNotEmpty()) "-$note" else ""}"
return statsMap.computeIfAbsent(suffix) {
Stats("completion-$suffix")
}
}
override fun tearDown() {
commitAllDocuments()
super.tearDown()
}
protected open fun doPerfTest(testPath: String) {
setUpFixture(testPath)
val tempSettings = CodeStyle.getSettings(project).clone()
CodeStyle.setTemporarySettings(project, tempSettings)
val fileText = FileUtil.loadFile(File(testPath))
val configured = configureCompilerOptions(fileText, project, module)
try {
assertTrue("\"<caret>\" is missing in file \"$testPath\"", fileText.contains("<caret>"))
val invocationCount = InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX) ?: 1
val lookupString = InTextDirectivesUtils.findStringWithPrefixes(fileText, LOOKUP_STRING_PREFIX)
val itemText = InTextDirectivesUtils.findStringWithPrefixes(fileText, ELEMENT_TEXT_PREFIX)
val tailText = InTextDirectivesUtils.findStringWithPrefixes(fileText, TAIL_TEXT_PREFIX)
val completionCharString = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHAR_PREFIX)
val completionChar = when(completionCharString) {
"\\n", null -> '\n'
"\\t" -> '\t'
else -> completionCharString.singleOrNull() ?: error("Incorrect completion char: \"$completionCharString\"")
}
val completionType = ExpectedCompletionUtils.getCompletionType(fileText) ?: defaultCompletionType
val kotlinStyleSettings = KotlinCodeStyleSettings.getInstance(project)
val commonStyleSettings = CodeStyle.getLanguageSettings(file)
for (line in InTextDirectivesUtils.findLinesWithPrefixesRemoved(fileText, CODE_STYLE_SETTING_PREFIX)) {
val index = line.indexOfOrNull('=') ?: error("Invalid code style setting '$line': '=' expected")
val settingName = line.substring(0, index).trim()
val settingValue = line.substring(index + 1).trim()
val (field, settings) = try {
kotlinStyleSettings::class.java.getField(settingName) to kotlinStyleSettings
} catch (e: NoSuchFieldException) {
commonStyleSettings::class.java.getField(settingName) to commonStyleSettings
}
when (field.type.name) {
"boolean" -> field.setBoolean(settings, settingValue.toBoolean())
"int" -> field.setInt(settings, settingValue.toInt())
else -> error("Unsupported setting type: ${field.type}")
}
}
doPerfTestWithTextLoaded(
testPath, completionType, invocationCount, lookupString, itemText, tailText, completionChar
)
} finally {
if (configured) {
rollbackCompilerOptions(project, module)
}
CodeStyle.dropTemporarySettings(project)
tearDownFixture()
}
}
private fun doPerfTestWithTextLoaded(
testPath: String,
completionType: CompletionType,
time: Int,
lookupString: String?,
itemText: String?,
tailText: String?,
completionChar: Char
) {
val testName = getTestName(false)
val stats = stats()
stats.perfTest(
testName = testName,
setUp = {
setUpFixture(testPath)
},
test = {
fixture.complete(completionType, time)
if (lookupString != null || itemText != null || tailText != null) {
val item = getExistentLookupElement(lookupString, itemText, tailText)
if (item != null) {
selectItem(item, completionChar)
}
}
},
tearDown = {
assertNotNull(it)
FileDocumentManager.getInstance().reloadFromDisk(editor.document)
fixture.configureByText(KotlinFileType.INSTANCE, "")
commitAllDocuments()
})
}
protected open fun setUpFixture(testPath: String) {
fixture.configureWithExtraFile(testPath, ".dependency", ".dependency.1", ".dependency.2")
}
protected open fun tearDownFixture() {
}
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
}
abstract class AbstractPerformanceBasicCompletionHandlerTest : AbstractPerformanceCompletionHandlerTests(CompletionType.BASIC)
abstract class AbstractPerformanceSmartCompletionHandlerTest : AbstractPerformanceCompletionHandlerTests(CompletionType.SMART)
abstract class AbstractPerformanceCompletionCharFilterTest : AbstractPerformanceCompletionHandlerTests(
CompletionType.BASIC,
note = "charFilter"
)
abstract class AbstractPerformanceKeywordCompletionHandlerTest : AbstractPerformanceCompletionHandlerTests(
CompletionType.BASIC,
note = "keyword"
)
@@ -0,0 +1,120 @@
/*
* 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.codeInsight.completion.CompletionType
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.completion.CompletionBindingContextProvider
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.junit.AfterClass
/**
* inspired by @see AbstractCompletionIncrementalResolveTest
*/
abstract class AbstractPerformanceCompletionIncrementalResolveTest : KotlinLightCodeInsightFixtureTestCase() {
private val BEFORE_MARKER = "<before>" // position to invoke completion before
private val CHANGE_MARKER = "<change>" // position to insert text specified by "TYPE" directive
private val TYPE_DIRECTIVE_PREFIX = "// TYPE:"
private val BACKSPACES_DIRECTIVE_PREFIX = "// BACKSPACES:"
companion object {
@JvmStatic
var warmedUp: Boolean = false
@JvmStatic
val stats: Stats = Stats("completion-incremental")
@AfterClass
@JvmStatic
fun teardown() {
stats.close()
}
}
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
override fun setUp() {
super.setUp()
if (!warmedUp) {
doWarmUpPerfTest()
warmedUp = true
}
}
override fun tearDown() {
commitAllDocuments()
super.tearDown()
}
private fun doWarmUpPerfTest() {
innerPerfTest("warm-up") {
myFixture.configureByText(
KotlinFileType.INSTANCE,
"class Foo {\n private val value: String? = n<caret>\n}"
)
}
}
protected fun doPerfTest(testPath: String) {
val testName = getTestName(false)
innerPerfTest(testName) {
myFixture.configureByFile(testPath)
val document = myFixture.editor.document
val beforeMarkerOffset = document.text.indexOf(BEFORE_MARKER)
assertTrue("\"$BEFORE_MARKER\" is missing in file \"$testPath\"", beforeMarkerOffset >= 0)
val changeMarkerOffset = document.text.indexOf(CHANGE_MARKER)
assertTrue("\"$CHANGE_MARKER\" is missing in file \"$testPath\"", changeMarkerOffset >= 0)
val textToType = InTextDirectivesUtils.findArrayWithPrefixes(document.text, TYPE_DIRECTIVE_PREFIX).singleOrNull()
?.let { StringUtil.unquoteString(it) }
val backspaceCount = InTextDirectivesUtils.getPrefixedInt(document.text, BACKSPACES_DIRECTIVE_PREFIX)
assertTrue(
"At least one of \"$TYPE_DIRECTIVE_PREFIX\" and \"$BACKSPACES_DIRECTIVE_PREFIX\" should be defined",
textToType != null || backspaceCount != null
)
val beforeMarker = document.createRangeMarker(beforeMarkerOffset, beforeMarkerOffset + BEFORE_MARKER.length)
val changeMarker = document.createRangeMarker(changeMarkerOffset, changeMarkerOffset + CHANGE_MARKER.length)
changeMarker.isGreedyToRight = true
project.executeWriteCommand("") {
document.deleteString(beforeMarker.startOffset, beforeMarker.endOffset)
document.deleteString(changeMarker.startOffset, changeMarker.endOffset)
}
editor.caretModel.moveToOffset(beforeMarker.startOffset)
}
}
private fun innerPerfTest(name: String, setUpBody: () -> Unit) {
CompletionBindingContextProvider.ENABLED = true
try {
stats.perfTest(
testName = name,
setUp = setUpBody,
test = { myFixture.complete(CompletionType.BASIC) },
tearDown = {
// no reasons to validate output as it is a performance test
assertNotNull(it)
FileDocumentManager.getInstance().reloadFromDisk(editor.document)
myFixture.configureByText(KotlinFileType.INSTANCE, "")
commitAllDocuments()
}
)
} finally {
CompletionBindingContextProvider.ENABLED = false
}
}
}
@@ -0,0 +1,88 @@
/*
* 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.openapi.fileEditor.FileDocumentManager
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.ensureIndexesUpToDate
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.junit.AfterClass
/**
* inspired by @see AbstractHighlightingTest
*/
abstract class AbstractPerformanceHighlightingTest : KotlinLightCodeInsightFixtureTestCase() {
companion object {
@JvmStatic
var warmedUp: Boolean = false
@JvmStatic
val stats: Stats = Stats("highlight")
@AfterClass
@JvmStatic
fun teardown() {
stats.close()
}
}
override fun setUp() {
super.setUp()
if (!warmedUp) {
doWarmUpPerfTest()
warmedUp = true
}
}
override fun tearDown() {
commitAllDocuments()
super.tearDown()
}
private fun doWarmUpPerfTest() {
innerPerfTest("warm-up") {
myFixture.configureByText(
KotlinFileType.INSTANCE,
"class Foo {\n private val value: String? = null\n}"
)
}
}
protected fun doPerfTest(filePath: String) {
val testName = getTestName(false)
innerPerfTest(testName) {
myFixture.configureByFile(filePath)
val project = myFixture.project
commitAllDocuments()
val file = myFixture.file
val offset = file.textOffset
assertTrue("side effect: to load the text", offset >= 0)
// to load AST for changed files before it's prohibited by "fileTreeAccessFilter"
ensureIndexesUpToDate(project)
}
}
private fun innerPerfTest(name: String, setUpBody: () -> Unit) {
stats.perfTest(
testName = name,
setUp = { setUpBody() },
test = { myFixture.doHighlighting() },
tearDown = {
assertNotNull("no reasons to validate output as it is a performance test", it)
FileDocumentManager.getInstance().reloadFromDisk(editor.document)
myFixture.configureByText(KotlinFileType.INSTANCE, "")
commitAllDocuments()
}
)
}
}
@@ -13,83 +13,105 @@ import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteCo
import org.jetbrains.kotlin.idea.conversion.copy.ConvertJavaCopyPasteProcessor import org.jetbrains.kotlin.idea.conversion.copy.ConvertJavaCopyPasteProcessor
import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.AfterClass
import java.io.File import java.io.File
abstract class AbstractPerformanceJavaToKotlinCopyPasteConversionTest(private val newJ2K: Boolean = false) : abstract class AbstractPerformanceJavaToKotlinCopyPasteConversionTest(private val newJ2K: Boolean = false) :
AbstractJavaToKotlinCopyPasteConversionTest() { AbstractJavaToKotlinCopyPasteConversionTest() {
private val stats: Stats = Stats("-${j2kPrefix()}-j2k")
companion object { companion object {
@JvmStatic @JvmStatic
var warmedUp: Array<Boolean> = arrayOf(false, false) val warmedUp: Array<Boolean> = arrayOf(false, false)
val stats: Array<Stats> = arrayOf(Stats("old j2k"), Stats("new j2k"))
@AfterClass
@JvmStatic
fun teardown() {
stats.forEach { it.close() }
}
} }
override fun setUp() { override fun setUp() {
super.setUp() super.setUp()
Registry.get("kotlin.use.new.j2k").setValue(newJ2K) Registry.get("kotlin.use.new.j2k").setValue(newJ2K)
val index = j2kIndex()
val index = if (newJ2K) 1 else 0
if (!warmedUp[index]) { if (!warmedUp[index]) {
doWarmUpPerfTest() doWarmUpPerfTest()
warmedUp[index] = true warmedUp[index] = true
} }
} }
private fun doWarmUpPerfTest() { override fun tearDown() {
val prefix = j2kPrefix() commitAllDocuments()
with(myFixture) { super.tearDown()
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 { private fun doWarmUpPerfTest() {
return if (newJ2K) "new" else "old" stats().perfTest(
testName = "warm-up",
setUp = {
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
},
test = {
myFixture.performEditorAction(IdeActions.ACTION_PASTE)
},
tearDown = {
commitAllDocuments()
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 j2kIndex(): Int {
return if (newJ2K) 1 else 0
} }
fun doPerfTest(path: String) { fun doPerfTest(path: String) {
myFixture.testDataPath = testDataPath
val testName = getTestName(false) val testName = getTestName(false)
myFixture.testDataPath = testDataPath
myFixture.configureByFiles("$testName.java") myFixture.configureByFiles("$testName.java")
configureByDependencyIfExists("$testName.dependency.java")
val fileText = myFixture.editor.document.text val fileText = myFixture.editor.document.text
val noConversionExpected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// NO_CONVERSION_EXPECTED").isNotEmpty() val noConversionExpected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// NO_CONVERSION_EXPECTED").isNotEmpty()
myFixture.performEditorAction(IdeActions.ACTION_COPY) stats().perfTest(
testName = testName,
setUp = {
myFixture.configureByFiles("$testName.java")
configureByDependencyIfExists("$testName.dependency.kt") myFixture.performEditorAction(IdeActions.ACTION_COPY)
configureByDependencyIfExists("$testName.dependency.java")
configureTargetFile("$testName.to.kt") configureByDependencyIfExists("$testName.dependency.kt")
ConvertJavaCopyPasteProcessor.conversionPerformed = false configureTargetFile("$testName.to.kt")
val prefix = j2kPrefix() ConvertJavaCopyPasteProcessor.conversionPerformed = false
},
attempts { test = {
tcSimplePerfTest(testName, "${prefix} java2kotlin conversion$it: $testName", stats) {
myFixture.performEditorAction(IdeActions.ACTION_PASTE) myFixture.performEditorAction(IdeActions.ACTION_PASTE)
},
tearDown = {
commitAllDocuments()
validate(path, noConversionExpected)
myFixture.performEditorAction(IdeActions.ACTION_UNDO)
} }
)
validate(path, noConversionExpected)
myFixture.performEditorAction(IdeActions.ACTION_UNDO)
}
} }
private fun stats() = stats[j2kIndex()]
open fun validate(path: String, noConversionExpected: Boolean) { open fun validate(path: String, noConversionExpected: Boolean) {
kotlin.test.assertEquals( kotlin.test.assertEquals(
noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed, noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed,
@@ -5,15 +5,12 @@
package org.jetbrains.kotlin.idea.perf package org.jetbrains.kotlin.idea.perf
import com.intellij.codeInsight.completion.CompletionType
import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.codeInsight.daemon.impl.HighlightInfo
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.codeInspection.ex.InspectionProfileImpl import com.intellij.codeInspection.ex.InspectionProfileImpl
import com.intellij.ide.highlighter.ModuleFileType import com.intellij.ide.highlighter.ModuleFileType
import com.intellij.idea.IdeaTestApplication import com.intellij.idea.IdeaTestApplication
import com.intellij.openapi.Disposable import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.command.CommandProcessor
import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.EditorFactory import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileDocumentManager
@@ -22,7 +19,6 @@ import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.module.ModuleTypeId import com.intellij.openapi.module.ModuleTypeId
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.openapi.projectRoots.JavaSdk import com.intellij.openapi.projectRoots.JavaSdk
import com.intellij.openapi.projectRoots.ProjectJdkTable import com.intellij.openapi.projectRoots.ProjectJdkTable
@@ -34,55 +30,26 @@ import com.intellij.openapi.vcs.changes.ChangeListManager
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl import com.intellij.openapi.vcs.changes.ChangeListManagerImpl
import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiFile import com.intellij.psi.PsiFile
import com.intellij.testFramework.LightPlatformTestCase
import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.PsiTestUtil
import com.intellij.testFramework.RunAll import com.intellij.testFramework.RunAll
import com.intellij.testFramework.UsefulTestCase import com.intellij.testFramework.UsefulTestCase
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory
import com.intellij.testFramework.fixtures.TempDirTestFixture
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl
import com.intellij.util.ThrowableRunnable import com.intellij.util.ThrowableRunnable
import com.intellij.util.io.exists import com.intellij.util.io.exists
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.core.util.toPsiFile import org.jetbrains.kotlin.idea.core.util.toPsiFile
import org.jetbrains.kotlin.idea.framework.KotlinSdkType import org.jetbrains.kotlin.idea.framework.KotlinSdkType
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil 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.io.File
import java.nio.file.Paths import java.nio.file.Paths
abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() { abstract class AbstractPerformanceProjectsTest : UsefulTestCase() {
// myProject is not required for all potential perf test cases // myProject is not required for all potential perf test cases
private var myProject: Project? = null private var myProject: Project? = null
private lateinit var jdk18: Sdk private lateinit var jdk18: Sdk
private lateinit var myApplication: IdeaTestApplication private lateinit var myApplication: IdeaTestApplication
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() { override fun setUp() {
super.setUp() super.setUp()
@@ -105,89 +72,74 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
KotlinSdkType.setUpIfNeeded() KotlinSdkType.setUpIfNeeded()
} }
InspectionProfileImpl.INIT_INSPECTIONS = true InspectionProfileImpl.INIT_INSPECTIONS = true
// warm up: open simple small project
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().closeAndDispose(project)
warmedUp = true
}
} }
override fun tearDown() { override fun tearDown() {
var runAll = RunAll() RunAll(
ThrowableRunnable { super.tearDown() },
if (myProject != null) { ThrowableRunnable {
PsiDocumentManager.getInstance(myProject!!).commitAllDocuments() if (myProject != null) {
runAll = runAll closeProject(myProject!!)
.append(ThrowableRunnable { LightPlatformTestCase.doTearDown(myProject!!, myApplication) }) myProject = null
}
runAll.append(ThrowableRunnable { super.tearDown() })
.run()
}
private fun getTempDirFixture(): TempDirTestFixture =
LightTempDirTestFixtureImpl(true)
protected fun perfChangeDocument(fileName: String, note: String = "", block: (document: Document) -> Unit) =
perfChangeDocument(myProject!!, fileName, note, block)
private fun perfChangeDocument(
project: Project,
fileName: String,
nameOfChange: String,
block: (document: Document) -> Unit
) {
val openFileInEditor = openFileInEditor(project, fileName)
val document = openFileInEditor.document
val manager = PsiDocumentManager.getInstance(project)
CommandProcessor.getInstance().executeCommand(project, {
ApplicationManager.getApplication().runWriteAction {
tcSimplePerfTest(fileName, "Changing doc $nameOfChange", stats) {
block(document)
manager.commitDocument(document)
} }
} }).run()
}, "change doc $fileName $nameOfChange", "")
manager.commitAllDocuments()
} }
protected fun perfOpenProject(name: String, path: String = "idea/testData/perfTest") { private fun simpleFilename(fileName: String): String {
myProject = innerPerfOpenProject(name, path = path, note = "") val lastIndexOf = fileName.lastIndexOf('/')
return if (lastIndexOf >= 0) fileName.substring(lastIndexOf + 1) else fileName
} }
private fun innerPerfOpenProject( protected fun perfOpenProject(name: String, stats: Stats, path: String = "idea/testData/perfTest") {
myProject = innerPerfOpenProject(name, stats, path = path, note = "")
}
protected fun innerPerfOpenProject(
name: String, name: String,
stats: Stats,
note: String, note: String,
path: String = "idea/testData/perfTest" path: String = "idea/testData/perfTest"
): Project { ): Project {
lateinit var project: Project
val projectPath = "$path/$name" val projectPath = "$path/$name"
tcSimplePerfTest("", "Project ${note}opening $name", stats) { val warmUpIterations = 1
project = ProjectManager.getInstance().loadAndOpenProject(projectPath)!! val iterations = 3
if (!Paths.get(projectPath, ".idea").exists()) { val projectManagerEx = ProjectManagerEx.getInstanceEx()
initKotlinProject(project, projectPath, name)
var lastProject: Project? = null
var counter = 0
stats.perfTest<Project, Project>(
warmUpIterations = warmUpIterations,
iterations = iterations,
testName = "open project${if (note.isNotEmpty()) " $note" else ""}",
test = {
val project = projectManagerEx.loadAndOpenProject(projectPath)!!
if (!Paths.get(projectPath, ".idea").exists()) {
initKotlinProject(project, projectPath, name)
}
projectManagerEx.openTestProject(project)
val changeListManagerImpl = ChangeListManager.getInstance(project) as ChangeListManagerImpl
changeListManagerImpl.waitUntilRefreshed()
project
},
tearDown = { project ->
lastProject = project
val prj = project!!
// close all project but last - we're going to return and use it further
if (counter < warmUpIterations + iterations - 1) {
closeProject(prj)
}
counter++
} }
)
ProjectManagerEx.getInstanceEx().openTestProject(project) return lastProject!!
disposeOnTearDown(Disposable { ProjectManagerEx.getInstanceEx().closeAndDispose(project) })
}
val changeListManagerImpl = ChangeListManager.getInstance(project) as ChangeListManagerImpl
changeListManagerImpl.waitUntilRefreshed()
PsiDocumentManager.getInstance(project).commitAllDocuments()
return project
} }
private fun initKotlinProject( private fun initKotlinProject(
@@ -206,66 +158,37 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
val moduleManager = ModuleManager.getInstance(project) val moduleManager = ModuleManager.getInstance(project)
val module = moduleManager.newModule(modulePath, ModuleTypeId.JAVA_MODULE) val module = moduleManager.newModule(modulePath, ModuleTypeId.JAVA_MODULE)
PsiTestUtil.addSourceRoot(module, srcFile) PsiTestUtil.addSourceRoot(module, srcFile)
module!! module
}) })
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(module, jdk18) ConfigLibraryUtil.configureKotlinRuntimeAndSdk(module, jdk18)
} }
protected fun perfHighlightFile(name: String): List<HighlightInfo> = protected fun perfHighlightFile(name: String, stats: Stats): List<HighlightInfo> =
perfHighlightFile(myProject!!, name) perfHighlightFile(myProject!!, name, stats)
private fun perfHighlightFile( protected fun perfHighlightFile(
project: Project, project: Project,
name: String, fileName: String,
stats: Stats,
note: String = "" note: String = ""
): List<HighlightInfo> { ): List<HighlightInfo> {
val fileInEditor = openFileInEditor(project, name) var highlightInfos: List<HighlightInfo> = emptyList()
val file = fileInEditor.psiFile stats.perfTest(
testName = "highlighting ${if (note.isNotEmpty()) "$note " else ""}${simpleFilename(fileName)}",
var highlightFile: List<HighlightInfo> = emptyList() setUp = {
tcSimplePerfTest(file.name, "Highlighting file $note${file.name}", stats) { val fileInEditor = openFileInEditor(project, fileName)
highlightFile = highlightFile(file) fileInEditor.psiFile
} },
return highlightFile test = { file ->
} highlightFile(file!!)
},
fun perfAutoCompletion( tearDown = {
name: String, highlightInfos = it ?: emptyList()
before: String, commitAllDocuments()
suggestions: Array<String>,
type: String,
after: String
) {
val factory = IdeaTestFixtureFactory.getFixtureFactory()
val fixtureBuilder = factory.createLightFixtureBuilder(KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE)
val tempDirFixture = getTempDirFixture()
val fixture = factory.createCodeInsightFixture(fixtureBuilder.fixture, tempDirFixture)
with(fixture) {
setUp()
configureByText(KotlinFileType.INSTANCE, before)
}
var complete: Array<LookupElement>? = null
tcSimplePerfTest("", "Auto completion $name", stats) {
with(fixture) {
complete = complete(CompletionType.BASIC)
} }
} )
return highlightInfos
val actualSuggestions = complete?.map { it.lookupString }?.toList() ?: emptyList()
assertTrue(actualSuggestions.containsAll(suggestions.toList()))
try {
with(fixture) {
type(type)
checkResult(after)
}
} finally {
PsiDocumentManager.getInstance(fixture.project).commitAllDocuments()
fixture.tearDown()
}
} }
private fun highlightFile(psiFile: PsiFile): List<HighlightInfo> { private fun highlightFile(psiFile: PsiFile): List<HighlightInfo> {
@@ -279,6 +202,9 @@ abstract class AbstractKotlinProjectsPerformanceTest : UsefulTestCase() {
private fun openFileInEditor(project: Project, name: String): EditorFile { private fun openFileInEditor(project: Project, name: String): EditorFile {
val psiFile = projectFileByName(project, name) val psiFile = projectFileByName(project, name)
val vFile = psiFile.virtualFile val vFile = psiFile.virtualFile
FileDocumentManager.getInstance().reloadFiles(vFile)
val fileEditorManager = FileEditorManager.getInstance(project) val fileEditorManager = FileEditorManager.getInstance(project)
fileEditorManager.openFile(vFile, true) fileEditorManager.openFile(vFile, true)
val document = FileDocumentManager.getInstance().getDocument(vFile)!! val document = FileDocumentManager.getInstance().getDocument(vFile)!!
@@ -1,86 +0,0 @@
/*
* 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
class KotlinProjectsPerformanceTest : AbstractKotlinProjectsPerformanceTest() {
fun testHelloWorldProject() {
tcSuite("HelloWorld") {
perfOpenProject("helloKotlin")
// highlight
perfHighlightFile("src/HelloMain.kt")
perfHighlightFile("src/HelloMain2.kt")
// change document
perfChangeDocument("src/HelloMain2.kt", "type a single char") { doc ->
val text = doc.text
val offset = text.indexOf("println")
doc.insertString(offset, "p\n")
}
perfChangeDocument("src/HelloMain.kt", "type val expression") { doc ->
val text = doc.text
val offset = text.indexOf("println")
doc.insertString(offset, "val s =\n")
}
}
}
fun testAutoCompletion() {
tcSuite("AutoCompletion") {
attempts {
perfAutoCompletion(
"inside of method: println$it",
"""
fun bar() {
print<caret>
}
""",
suggestions = arrayOf("println", "print"),
type = "l\r",
after = """
fun bar() {
println()
}
"""
)
}
attempts {
perfAutoCompletion(
"outside of method: arrayListOf$it",
before = """
val f: List<String> = array<caret>
fun bar(){ }
""",
type = "\n",
suggestions = arrayOf("arrayOf", "arrayOfNulls", "emptyArray"),
after = """
val f: List<String> = arrayListOf()
fun bar(){ }
"""
)
}
}
}
fun testKotlinProject() {
tcSuite("Kotlin") {
perfOpenProject("perfTestProject", "..")
perfHighlightFile("compiler/psi/src/org/jetbrains/kotlin/psi/KtFile.kt")
perfHighlightFile("compiler/psi/src/org/jetbrains/kotlin/psi/KtElement.kt")
}
}
}
@@ -0,0 +1,904 @@
/*
* 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/idea-completion/testData/handlers/basic")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceBasicCompletionHandlerTestGenerated extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("AddLabelToReturn.kt")
public void testAddLabelToReturn() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/AddLabelToReturn.kt");
}
public void testAllFilesPresentInBasic() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("ClassKeywordBeforeName.kt")
public void testClassKeywordBeforeName() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ClassKeywordBeforeName.kt");
}
@TestMetadata("ClassWithClassObject.kt")
public void testClassWithClassObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ClassWithClassObject.kt");
}
@TestMetadata("DoNotUseParenthesisOnNextLine.kt")
public void testDoNotUseParenthesisOnNextLine() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/DoNotUseParenthesisOnNextLine.kt");
}
@TestMetadata("EA70229.kt")
public void testEA70229() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/EA70229.kt");
}
@TestMetadata("ExtensionFunctionTypeVariable1.kt")
public void testExtensionFunctionTypeVariable1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ExtensionFunctionTypeVariable1.kt");
}
@TestMetadata("ExtensionFunctionTypeVariable2.kt")
public void testExtensionFunctionTypeVariable2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ExtensionFunctionTypeVariable2.kt");
}
@TestMetadata("ExtensionReceiverTypeArg.kt")
public void testExtensionReceiverTypeArg() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ExtensionReceiverTypeArg.kt");
}
@TestMetadata("FirstTypeArgument.kt")
public void testFirstTypeArgument() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/FirstTypeArgument.kt");
}
@TestMetadata("GenericFunctionWithTab.kt")
public void testGenericFunctionWithTab() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/GenericFunctionWithTab.kt");
}
@TestMetadata("GenericFunctionWithTab2.kt")
public void testGenericFunctionWithTab2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/GenericFunctionWithTab2.kt");
}
@TestMetadata("GetOperator.kt")
public void testGetOperator() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/GetOperator.kt");
}
@TestMetadata("InterfaceNameBeforeRunBug.kt")
public void testInterfaceNameBeforeRunBug() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/InterfaceNameBeforeRunBug.kt");
}
@TestMetadata("JavaSAM.kt")
public void testJavaSAM() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/JavaSAM.kt");
}
@TestMetadata("KT11633.kt")
public void testKT11633() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT11633.kt");
}
@TestMetadata("KT12328.kt")
public void testKT12328() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT12328.kt");
}
@TestMetadata("KT14130.kt")
public void testKT14130() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT14130.kt");
}
@TestMetadata("KT19863.kt")
public void testKT19863() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT19863.kt");
}
@TestMetadata("KT19864.kt")
public void testKT19864() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT19864.kt");
}
@TestMetadata("KT23627.kt")
public void testKT23627() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/KT23627.kt");
}
@TestMetadata("NestedTypeArg.kt")
public void testNestedTypeArg() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/NestedTypeArg.kt");
}
@TestMetadata("NoTailFromSmart.kt")
public void testNoTailFromSmart() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/NoTailFromSmart.kt");
}
@TestMetadata("PreferClassToConstructor.kt")
public void testPreferClassToConstructor() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/PreferClassToConstructor.kt");
}
@TestMetadata("PreferMatchingKeyword.kt")
public void testPreferMatchingKeyword() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/PreferMatchingKeyword.kt");
}
@TestMetadata("ReplaceFunctionCallByProperty.kt")
public void testReplaceFunctionCallByProperty() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ReplaceFunctionCallByProperty.kt");
}
@TestMetadata("ReplaceFunctionCallByPropertyArgs.kt")
public void testReplaceFunctionCallByPropertyArgs() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/ReplaceFunctionCallByPropertyArgs.kt");
}
@TestMetadata("SecondTypeArg.kt")
public void testSecondTypeArg() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SecondTypeArg.kt");
}
@TestMetadata("SpaceAfterParenthesisBug.kt")
public void testSpaceAfterParenthesisBug() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SpaceAfterParenthesisBug.kt");
}
@TestMetadata("StringFakeConstructor.kt")
public void testStringFakeConstructor() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/StringFakeConstructor.kt");
}
@TestMetadata("SuperMethod.kt")
public void testSuperMethod() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SuperMethod.kt");
}
@TestMetadata("SuperMethod2.kt")
public void testSuperMethod2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SuperMethod2.kt");
}
@TestMetadata("SuperTypeArg.kt")
public void testSuperTypeArg() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SuperTypeArg.kt");
}
@TestMetadata("SyntheticExtension.kt")
public void testSyntheticExtension() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/SyntheticExtension.kt");
}
@TestMetadata("TypeInferedFromWrapperType.kt")
public void testTypeInferedFromWrapperType() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/TypeInferedFromWrapperType.kt");
}
@TestMetadata("TypeParameter.kt")
public void testTypeParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/TypeParameter.kt");
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/annotation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Annotation extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInAnnotation() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/annotation"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AnnotationInBrackets.kt")
public void testAnnotationInBrackets() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/annotation/AnnotationInBrackets.kt");
}
@TestMetadata("AnnotationInClassAddImport.kt")
public void testAnnotationInClassAddImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/annotation/AnnotationInClassAddImport.kt");
}
@TestMetadata("AnnotationInCompanionObjectAddImport.kt")
public void testAnnotationInCompanionObjectAddImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/annotation/AnnotationInCompanionObjectAddImport.kt");
}
@TestMetadata("KT12077.kt")
public void testKT12077() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/annotation/KT12077.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/callableReference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CallableReference extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInCallableReference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/callableReference"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("ClassConstructor.kt")
public void testClassConstructor() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/callableReference/ClassConstructor.kt");
}
@TestMetadata("EmptyQualifier.kt")
public void testEmptyQualifier() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/callableReference/EmptyQualifier.kt");
}
@TestMetadata("NonEmptyQualifier.kt")
public void testNonEmptyQualifier() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/callableReference/NonEmptyQualifier.kt");
}
@TestMetadata("NotImportedTopLevel.kt")
public void testNotImportedTopLevel() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/callableReference/NotImportedTopLevel.kt");
}
@TestMetadata("Property.kt")
public void testProperty() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/callableReference/Property.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/exclChar")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ExclChar extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("1.kt")
public void test1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/exclChar/1.kt");
}
@TestMetadata("2.kt")
public void test2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/exclChar/2.kt");
}
@TestMetadata("3.kt")
public void test3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/exclChar/3.kt");
}
@TestMetadata("4.kt")
public void test4() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/exclChar/4.kt");
}
@TestMetadata("5.kt")
public void test5() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/exclChar/5.kt");
}
public void testAllFilesPresentInExclChar() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/exclChar"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/highOrderFunctions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class HighOrderFunctions extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInHighOrderFunctions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/highOrderFunctions"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("ContextVariable.kt")
public void testContextVariable() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ContextVariable.kt");
}
@TestMetadata("ContextVariableDot.kt")
public void testContextVariableDot() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ContextVariableDot.kt");
}
@TestMetadata("ContextVariableTypeArgsNeeded.kt")
public void testContextVariableTypeArgsNeeded() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ContextVariableTypeArgsNeeded.kt");
}
@TestMetadata("ForceParenthesisForTabChar.kt")
public void testForceParenthesisForTabChar() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ForceParenthesisForTabChar.kt");
}
@TestMetadata("FunctionLiteralInsertOnSpace.kt")
public void testFunctionLiteralInsertOnSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/FunctionLiteralInsertOnSpace.kt");
}
@TestMetadata("FunctionLiteralInsertWhenNoSpacesForBraces.kt")
public void testFunctionLiteralInsertWhenNoSpacesForBraces() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/FunctionLiteralInsertWhenNoSpacesForBraces.kt");
}
@TestMetadata("HigherOrderFunction.kt")
public void testHigherOrderFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/HigherOrderFunction.kt");
}
@TestMetadata("HigherOrderFunctionWithArg.kt")
public void testHigherOrderFunctionWithArg() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/HigherOrderFunctionWithArg.kt");
}
@TestMetadata("HigherOrderFunctionWithArgs1.kt")
public void testHigherOrderFunctionWithArgs1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/HigherOrderFunctionWithArgs1.kt");
}
@TestMetadata("HigherOrderFunctionWithArgs2.kt")
public void testHigherOrderFunctionWithArgs2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/HigherOrderFunctionWithArgs2.kt");
}
@TestMetadata("HigherOrderFunctionWithArgs3.kt")
public void testHigherOrderFunctionWithArgs3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/HigherOrderFunctionWithArgs3.kt");
}
@TestMetadata("InsertFunctionWithSingleParameterWithBrace.kt")
public void testInsertFunctionWithSingleParameterWithBrace() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/InsertFunctionWithSingleParameterWithBrace.kt");
}
@TestMetadata("OptionalParameters1.kt")
public void testOptionalParameters1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/OptionalParameters1.kt");
}
@TestMetadata("OptionalParameters2.kt")
public void testOptionalParameters2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/OptionalParameters2.kt");
}
@TestMetadata("OptionalParameters3.kt")
public void testOptionalParameters3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/OptionalParameters3.kt");
}
@TestMetadata("ParameterTypeIsDerivedFromFunction.kt")
public void testParameterTypeIsDerivedFromFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ParameterTypeIsDerivedFromFunction.kt");
}
@TestMetadata("ReplaceByLambdaTemplateNoClosingParenth.kt")
public void testReplaceByLambdaTemplateNoClosingParenth() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/ReplaceByLambdaTemplateNoClosingParenth.kt");
}
@TestMetadata("WithArgsEmptyLambdaAfter.kt")
public void testWithArgsEmptyLambdaAfter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/WithArgsEmptyLambdaAfter.kt");
}
@TestMetadata("WithArgsNonEmptyLambdaAfter.kt")
public void testWithArgsNonEmptyLambdaAfter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/highOrderFunctions/WithArgsNonEmptyLambdaAfter.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/importAliases")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ImportAliases extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInImportAliases() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/importAliases"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("CompanionObject.kt")
public void testCompanionObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/CompanionObject.kt");
}
@TestMetadata("ExtensionFun.kt")
public void testExtensionFun() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/ExtensionFun.kt");
}
@TestMetadata("ExtensionVal.kt")
public void testExtensionVal() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/ExtensionVal.kt");
}
@TestMetadata("KDoc.kt")
public void testKDoc() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/KDoc.kt");
}
@TestMetadata("TopLevelFun.kt")
public void testTopLevelFun() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/TopLevelFun.kt");
}
@TestMetadata("TopLevelVal.kt")
public void testTopLevelVal() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/TopLevelVal.kt");
}
@TestMetadata("Type.kt")
public void testType() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/importAliases/Type.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/override")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Override extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("AfterFunKeyword.kt")
public void testAfterFunKeyword() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/AfterFunKeyword.kt");
}
@TestMetadata("AfterFunKeywordKeepModifiersBefore.kt")
public void testAfterFunKeywordKeepModifiersBefore() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/AfterFunKeywordKeepModifiersBefore.kt");
}
@TestMetadata("AfterValKeyword.kt")
public void testAfterValKeyword() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/AfterValKeyword.kt");
}
@TestMetadata("AfterValKeywordInConstructorParameter.kt")
public void testAfterValKeywordInConstructorParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/AfterValKeywordInConstructorParameter.kt");
}
public void testAllFilesPresentInOverride() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/override"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("ExpectClassValOverride.kt")
public void testExpectClassValOverride() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ExpectClassValOverride.kt");
}
@TestMetadata("ImplementFunction.kt")
public void testImplementFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ImplementFunction.kt");
}
@TestMetadata("ImplementVal.kt")
public void testImplementVal() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ImplementVal.kt");
}
@TestMetadata("ImplementVar.kt")
public void testImplementVar() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ImplementVar.kt");
}
@TestMetadata("KeepAnnotationBefore.kt")
public void testKeepAnnotationBefore() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/KeepAnnotationBefore.kt");
}
@TestMetadata("KeepModifiersBefore.kt")
public void testKeepModifiersBefore() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/KeepModifiersBefore.kt");
}
@TestMetadata("kt25312.kt")
public void testKt25312() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/kt25312.kt");
}
@TestMetadata("OverrideFunction.kt")
public void testOverrideFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/OverrideFunction.kt");
}
@TestMetadata("OverrideVar.kt")
public void testOverrideVar() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/OverrideVar.kt");
}
@TestMetadata("PublicValInConstructorParameter.kt")
public void testPublicValInConstructorParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/PublicValInConstructorParameter.kt");
}
@TestMetadata("Suspend.kt")
public void testSuspend() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/Suspend.kt");
}
@TestMetadata("TypeFunctionName.kt")
public void testTypeFunctionName() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/TypeFunctionName.kt");
}
@TestMetadata("TypeNameInConstructorParameter.kt")
public void testTypeNameInConstructorParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/TypeNameInConstructorParameter.kt");
}
@TestMetadata("ValInConstructorParameter.kt")
public void testValInConstructorParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ValInConstructorParameter.kt");
}
@TestMetadata("ValInConstructorParameter2.kt")
public void testValInConstructorParameter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ValInConstructorParameter2.kt");
}
@TestMetadata("ValInConstructorParameter3.kt")
public void testValInConstructorParameter3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ValInConstructorParameter3.kt");
}
@TestMetadata("ValInConstructorParameter4.kt")
public void testValInConstructorParameter4() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/override/ValInConstructorParameter4.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/parameterNameAndType")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ParameterNameAndType extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInParameterNameAndType() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/parameterNameAndType"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("CodeStyleSettings.kt")
public void testCodeStyleSettings() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/CodeStyleSettings.kt");
}
@TestMetadata("Comma.kt")
public void testComma() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/Comma.kt");
}
@TestMetadata("InsertImport.kt")
public void testInsertImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/InsertImport.kt");
}
@TestMetadata("NoInsertionOnTypingColon.kt")
public void testNoInsertionOnTypingColon() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/NoInsertionOnTypingColon.kt");
}
@TestMetadata("NoInsertionOnTypingSpace.kt")
public void testNoInsertionOnTypingSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/NoInsertionOnTypingSpace.kt");
}
@TestMetadata("ParameterInFile.kt")
public void testParameterInFile() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/ParameterInFile.kt");
}
@TestMetadata("ParameterInFile2.kt")
public void testParameterInFile2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/ParameterInFile2.kt");
}
@TestMetadata("Simple.kt")
public void testSimple() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/Simple.kt");
}
@TestMetadata("TabReplace1.kt")
public void testTabReplace1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/TabReplace1.kt");
}
@TestMetadata("TabReplace2.kt")
public void testTabReplace2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/TabReplace2.kt");
}
@TestMetadata("TabReplace3.kt")
public void testTabReplace3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/TabReplace3.kt");
}
@TestMetadata("TypeParameter.kt")
public void testTypeParameter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/TypeParameter.kt");
}
@TestMetadata("UserPrefix.kt")
public void testUserPrefix() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/parameterNameAndType/UserPrefix.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StaticMemberOfNotImported extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInStaticMemberOfNotImported() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AmbigiousExtension.kt")
public void testAmbigiousExtension() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported/AmbigiousExtension.kt");
}
@TestMetadata("AmbigiousName.kt")
public void testAmbigiousName() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported/AmbigiousName.kt");
}
@TestMetadata("CompanionObjectMember.kt")
public void testCompanionObjectMember() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported/CompanionObjectMember.kt");
}
@TestMetadata("EnumEntry.kt")
public void testEnumEntry() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported/EnumEntry.kt");
}
@TestMetadata("ObjectMember.kt")
public void testObjectMember() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMemberOfNotImported/ObjectMember.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/staticMembers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StaticMembers extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInStaticMembers() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/staticMembers"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("classObjectMethod.kt")
public void testClassObjectMethod() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMembers/classObjectMethod.kt");
}
@TestMetadata("ImportFromCompanionObject.kt")
public void testImportFromCompanionObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMembers/ImportFromCompanionObject.kt");
}
@TestMetadata("ImportJavaStaticMethod.kt")
public void testImportJavaStaticMethod() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMembers/ImportJavaStaticMethod.kt");
}
@TestMetadata("JavaStaticMethod.kt")
public void testJavaStaticMethod() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/staticMembers/JavaStaticMethod.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/stringTemplate")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StringTemplate extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("1.kt")
public void test1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/1.kt");
}
@TestMetadata("2.kt")
public void test2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/2.kt");
}
@TestMetadata("3.kt")
public void test3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/3.kt");
}
@TestMetadata("4.kt")
public void test4() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/4.kt");
}
@TestMetadata("AfterDot1.kt")
public void testAfterDot1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/AfterDot1.kt");
}
@TestMetadata("AfterDot2.kt")
public void testAfterDot2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/AfterDot2.kt");
}
@TestMetadata("AfterDot3.kt")
public void testAfterDot3() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/AfterDot3.kt");
}
@TestMetadata("AfterDot4.kt")
public void testAfterDot4() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/AfterDot4.kt");
}
@TestMetadata("AfterThisDot.kt")
public void testAfterThisDot() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/AfterThisDot.kt");
}
public void testAllFilesPresentInStringTemplate() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/stringTemplate"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("GlobalVal.kt")
public void testGlobalVal() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/GlobalVal.kt");
}
@TestMetadata("GlobalValInCurlyBraces.kt")
public void testGlobalValInCurlyBraces() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/GlobalValInCurlyBraces.kt");
}
@TestMetadata("InsertCurlyBracesBeforeLetter.kt")
public void testInsertCurlyBracesBeforeLetter() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/InsertCurlyBracesBeforeLetter.kt");
}
@TestMetadata("NotEmptyPrefix.kt")
public void testNotEmptyPrefix() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/NotEmptyPrefix.kt");
}
@TestMetadata("Replace.kt")
public void testReplace() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/Replace.kt");
}
@TestMetadata("ValInObject.kt")
public void testValInObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/stringTemplate/ValInObject.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/basic/typeArgsForCall")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeArgsForCall extends AbstractPerformanceBasicCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("AfterElse.kt")
public void testAfterElse() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/AfterElse.kt");
}
@TestMetadata("AfterElvis.kt")
public void testAfterElvis() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/AfterElvis.kt");
}
public void testAllFilesPresentInTypeArgsForCall() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/basic/typeArgsForCall"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("ExpectedTypeDoesNotHelp.kt")
public void testExpectedTypeDoesNotHelp() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/ExpectedTypeDoesNotHelp.kt");
}
@TestMetadata("ExpectedTypeDoesNotHelp2.kt")
public void testExpectedTypeDoesNotHelp2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/ExpectedTypeDoesNotHelp2.kt");
}
@TestMetadata("ExplicitLambdaSignature.kt")
public void testExplicitLambdaSignature() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/ExplicitLambdaSignature.kt");
}
@TestMetadata("FunctionTypeParameter1.kt")
public void testFunctionTypeParameter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/FunctionTypeParameter1.kt");
}
@TestMetadata("FunctionTypeParameter2.kt")
public void testFunctionTypeParameter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/FunctionTypeParameter2.kt");
}
@TestMetadata("HasExpectedType.kt")
public void testHasExpectedType() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/HasExpectedType.kt");
}
@TestMetadata("NotAllTypeArgumentsFromParameters.kt")
public void testNotAllTypeArgumentsFromParameters() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/NotAllTypeArgumentsFromParameters.kt");
}
@TestMetadata("ReplaceByTab1.kt")
public void testReplaceByTab1() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/ReplaceByTab1.kt");
}
@TestMetadata("ReplaceByTab2.kt")
public void testReplaceByTab2() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/ReplaceByTab2.kt");
}
@TestMetadata("Simple.kt")
public void testSimple() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/Simple.kt");
}
@TestMetadata("TypeArgumentsFromParameters.kt")
public void testTypeArgumentsFromParameters() throws Exception {
runTest("idea/idea-completion/testData/handlers/basic/typeArgsForCall/TypeArgumentsFromParameters.kt");
}
}
}
@@ -0,0 +1,186 @@
/*
* 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/idea-completion/testData/handlers/charFilter")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceCompletionCharFilterTestGenerated extends AbstractPerformanceCompletionCharFilterTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInCharFilter() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/charFilter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Colon.kt")
public void testColon() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Colon.kt");
}
@TestMetadata("Comma1.kt")
public void testComma1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Comma1.kt");
}
@TestMetadata("Comma2.kt")
public void testComma2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Comma2.kt");
}
@TestMetadata("Comma3.kt")
public void testComma3() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Comma3.kt");
}
@TestMetadata("Comma4.kt")
public void testComma4() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Comma4.kt");
}
@TestMetadata("Comma5.kt")
public void testComma5() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Comma5.kt");
}
@TestMetadata("CommaForFunction1.kt")
public void testCommaForFunction1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/CommaForFunction1.kt");
}
@TestMetadata("CommaForFunction2.kt")
public void testCommaForFunction2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/CommaForFunction2.kt");
}
@TestMetadata("ConstructorWithLambdaArg1.kt")
public void testConstructorWithLambdaArg1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/ConstructorWithLambdaArg1.kt");
}
@TestMetadata("ConstructorWithLambdaArg2.kt")
public void testConstructorWithLambdaArg2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/ConstructorWithLambdaArg2.kt");
}
@TestMetadata("Dot.kt")
public void testDot() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Dot.kt");
}
@TestMetadata("DotAfterFun1.kt")
public void testDotAfterFun1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/DotAfterFun1.kt");
}
@TestMetadata("DotAfterFun2.kt")
public void testDotAfterFun2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/DotAfterFun2.kt");
}
@TestMetadata("Eq1.kt")
public void testEq1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Eq1.kt");
}
@TestMetadata("Eq2.kt")
public void testEq2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Eq2.kt");
}
@TestMetadata("FunctionLiteralParameter1.kt")
public void testFunctionLiteralParameter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/FunctionLiteralParameter1.kt");
}
@TestMetadata("FunctionLiteralParameter2.kt")
public void testFunctionLiteralParameter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/FunctionLiteralParameter2.kt");
}
@TestMetadata("FunctionLiteralParameter3.kt")
public void testFunctionLiteralParameter3() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/FunctionLiteralParameter3.kt");
}
@TestMetadata("FunctionWithLambdaArg1.kt")
public void testFunctionWithLambdaArg1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/FunctionWithLambdaArg1.kt");
}
@TestMetadata("FunctionWithLambdaArg2.kt")
public void testFunctionWithLambdaArg2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/FunctionWithLambdaArg2.kt");
}
@TestMetadata("InfixCallAndSpace.kt")
public void testInfixCallAndSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/InfixCallAndSpace.kt");
}
@TestMetadata("KeywordAndSpace.kt")
public void testKeywordAndSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/KeywordAndSpace.kt");
}
@TestMetadata("LParenth.kt")
public void testLParenth() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/LParenth.kt");
}
@TestMetadata("NamedParameter1.kt")
public void testNamedParameter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/NamedParameter1.kt");
}
@TestMetadata("NamedParameter2.kt")
public void testNamedParameter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/NamedParameter2.kt");
}
@TestMetadata("QualifiedThis.kt")
public void testQualifiedThis() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/QualifiedThis.kt");
}
@TestMetadata("RangeTyping.kt")
public void testRangeTyping() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/RangeTyping.kt");
}
@TestMetadata("Space.kt")
public void testSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/Space.kt");
}
@TestMetadata("VariableName.kt")
public void testVariableName() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/VariableName.kt");
}
@TestMetadata("VariableName2.kt")
public void testVariableName2() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/VariableName2.kt");
}
@TestMetadata("VariableName3.kt")
public void testVariableName3() throws Exception {
runTest("idea/idea-completion/testData/handlers/charFilter/VariableName3.kt");
}
}
@@ -0,0 +1,81 @@
/*
* 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/idea-completion/testData/incrementalResolve")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceCompletionIncrementalResolveTestGenerated extends AbstractPerformanceCompletionIncrementalResolveTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInIncrementalResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/incrementalResolve"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("codeAboveChanged.kt")
public void testCodeAboveChanged() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/codeAboveChanged.kt");
}
@TestMetadata("codeAboveChanged2.kt")
public void testCodeAboveChanged2() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/codeAboveChanged2.kt");
}
@TestMetadata("dataFlowInfoFromPrevStatement.kt")
public void testDataFlowInfoFromPrevStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/dataFlowInfoFromPrevStatement.kt");
}
@TestMetadata("dataFlowInfoFromSameStatement.kt")
public void testDataFlowInfoFromSameStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/dataFlowInfoFromSameStatement.kt");
}
@TestMetadata("doNotAnalyzeComplexStatement.kt")
public void testDoNotAnalyzeComplexStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/doNotAnalyzeComplexStatement.kt");
}
@TestMetadata("noDataFlowFromOldStatement.kt")
public void testNoDataFlowFromOldStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/noDataFlowFromOldStatement.kt");
}
@TestMetadata("noPrevStatement.kt")
public void testNoPrevStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/noPrevStatement.kt");
}
@TestMetadata("outOfBlockModification.kt")
public void testOutOfBlockModification() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/outOfBlockModification.kt");
}
@TestMetadata("prevStatementNotResolved.kt")
public void testPrevStatementNotResolved() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/prevStatementNotResolved.kt");
}
@TestMetadata("sameStatement.kt")
public void testSameStatement() throws Exception {
runTest("idea/idea-completion/testData/incrementalResolve/sameStatement.kt");
}
}
@@ -0,0 +1,239 @@
/*
* 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/highlighter")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceHighlightingTestGenerated extends AbstractPerformanceHighlightingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInHighlighter() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/highlighter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Annotations.kt")
public void testAnnotations() throws Exception {
runTest("idea/testData/highlighter/Annotations.kt");
}
@TestMetadata("Destructuring.kt")
public void testDestructuring() throws Exception {
runTest("idea/testData/highlighter/Destructuring.kt");
}
@TestMetadata("Dynamic.kt")
public void testDynamic() throws Exception {
runTest("idea/testData/highlighter/Dynamic.kt");
}
@TestMetadata("Enums.kt")
public void testEnums() throws Exception {
runTest("idea/testData/highlighter/Enums.kt");
}
@TestMetadata("Field.kt")
public void testField() throws Exception {
runTest("idea/testData/highlighter/Field.kt");
}
@TestMetadata("Functions.kt")
public void testFunctions() throws Exception {
runTest("idea/testData/highlighter/Functions.kt");
}
@TestMetadata("InvokeCall.kt")
public void testInvokeCall() throws Exception {
runTest("idea/testData/highlighter/InvokeCall.kt");
}
@TestMetadata("JavaTypes.kt")
public void testJavaTypes() throws Exception {
runTest("idea/testData/highlighter/JavaTypes.kt");
}
@TestMetadata("KDoc.kt")
public void testKDoc() throws Exception {
runTest("idea/testData/highlighter/KDoc.kt");
}
@TestMetadata("KotlinInjection.kt")
public void testKotlinInjection() throws Exception {
runTest("idea/testData/highlighter/KotlinInjection.kt");
}
@TestMetadata("Labels.kt")
public void testLabels() throws Exception {
runTest("idea/testData/highlighter/Labels.kt");
}
@TestMetadata("NamedArguments.kt")
public void testNamedArguments() throws Exception {
runTest("idea/testData/highlighter/NamedArguments.kt");
}
@TestMetadata("NonNullAssertion.kt")
public void testNonNullAssertion() throws Exception {
runTest("idea/testData/highlighter/NonNullAssertion.kt");
}
@TestMetadata("Object.kt")
public void testObject() throws Exception {
runTest("idea/testData/highlighter/Object.kt");
}
@TestMetadata("SmartCast.kt")
public void testSmartCast() throws Exception {
runTest("idea/testData/highlighter/SmartCast.kt");
}
@TestMetadata("SyntheticExtensionProperty.kt")
public void testSyntheticExtensionProperty() throws Exception {
runTest("idea/testData/highlighter/SyntheticExtensionProperty.kt");
}
@TestMetadata("Todo.kt")
public void testTodo() throws Exception {
runTest("idea/testData/highlighter/Todo.kt");
}
@TestMetadata("TopLevelDestructuring.kt")
public void testTopLevelDestructuring() throws Exception {
runTest("idea/testData/highlighter/TopLevelDestructuring.kt");
}
@TestMetadata("TopLevelOpenSuspendFun.kt")
public void testTopLevelOpenSuspendFun() throws Exception {
runTest("idea/testData/highlighter/TopLevelOpenSuspendFun.kt");
}
@TestMetadata("TypeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("idea/testData/highlighter/TypeAlias.kt");
}
@TestMetadata("TypesAndAnnotations.kt")
public void testTypesAndAnnotations() throws Exception {
runTest("idea/testData/highlighter/TypesAndAnnotations.kt");
}
@TestMetadata("Variables.kt")
public void testVariables() throws Exception {
runTest("idea/testData/highlighter/Variables.kt");
}
@TestMetadata("VariablesAsFunctions.kt")
public void testVariablesAsFunctions() throws Exception {
runTest("idea/testData/highlighter/VariablesAsFunctions.kt");
}
@TestMetadata("idea/testData/highlighter/deprecated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Deprecated extends AbstractPerformanceHighlightingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInDeprecated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/highlighter/deprecated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Class.kt")
public void testClass() throws Exception {
runTest("idea/testData/highlighter/deprecated/Class.kt");
}
@TestMetadata("ClassObject.kt")
public void testClassObject() throws Exception {
runTest("idea/testData/highlighter/deprecated/ClassObject.kt");
}
@TestMetadata("Constructor.kt")
public void testConstructor() throws Exception {
runTest("idea/testData/highlighter/deprecated/Constructor.kt");
}
@TestMetadata("ExtensionFunction.kt")
public void testExtensionFunction() throws Exception {
runTest("idea/testData/highlighter/deprecated/ExtensionFunction.kt");
}
@TestMetadata("Function.kt")
public void testFunction() throws Exception {
runTest("idea/testData/highlighter/deprecated/Function.kt");
}
@TestMetadata("Get.kt")
public void testGet() throws Exception {
runTest("idea/testData/highlighter/deprecated/Get.kt");
}
@TestMetadata("Getter.kt")
public void testGetter() throws Exception {
runTest("idea/testData/highlighter/deprecated/Getter.kt");
}
@TestMetadata("Inc.kt")
public void testInc() throws Exception {
runTest("idea/testData/highlighter/deprecated/Inc.kt");
}
@TestMetadata("Invalid.kt")
public void testInvalid() throws Exception {
runTest("idea/testData/highlighter/deprecated/Invalid.kt");
}
@TestMetadata("Invoke.kt")
public void testInvoke() throws Exception {
runTest("idea/testData/highlighter/deprecated/Invoke.kt");
}
@TestMetadata("Operation.kt")
public void testOperation() throws Exception {
runTest("idea/testData/highlighter/deprecated/Operation.kt");
}
@TestMetadata("Property.kt")
public void testProperty() throws Exception {
runTest("idea/testData/highlighter/deprecated/Property.kt");
}
@TestMetadata("RangeTo.kt")
public void testRangeTo() throws Exception {
runTest("idea/testData/highlighter/deprecated/RangeTo.kt");
}
@TestMetadata("Setter.kt")
public void testSetter() throws Exception {
runTest("idea/testData/highlighter/deprecated/Setter.kt");
}
@TestMetadata("SuperCall.kt")
public void testSuperCall() throws Exception {
runTest("idea/testData/highlighter/deprecated/SuperCall.kt");
}
@TestMetadata("Trait.kt")
public void testTrait() throws Exception {
runTest("idea/testData/highlighter/deprecated/Trait.kt");
}
}
}
@@ -0,0 +1,206 @@
/*
* 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/idea-completion/testData/handlers/keywords")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceKeywordCompletionHandlerTestGenerated extends AbstractPerformanceKeywordCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("AddCompanionToObject.kt")
public void testAddCompanionToObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/AddCompanionToObject.kt");
}
public void testAllFilesPresentInKeywords() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/keywords"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Break.kt")
public void testBreak() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Break.kt");
}
@TestMetadata("Catch.kt")
public void testCatch() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Catch.kt");
}
@TestMetadata("CompanionObject.kt")
public void testCompanionObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/CompanionObject.kt");
}
@TestMetadata("Constructor.kt")
public void testConstructor() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Constructor.kt");
}
@TestMetadata("ConstructorPrimary.kt")
public void testConstructorPrimary() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ConstructorPrimary.kt");
}
@TestMetadata("Do.kt")
public void testDo() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Do.kt");
}
@TestMetadata("FileKeyword.kt")
public void testFileKeyword() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/FileKeyword.kt");
}
@TestMetadata("Finally.kt")
public void testFinally() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Finally.kt");
}
@TestMetadata("For.kt")
public void testFor() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/For.kt");
}
@TestMetadata("Getter1.kt")
public void testGetter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Getter1.kt");
}
@TestMetadata("Getter2.kt")
public void testGetter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Getter2.kt");
}
@TestMetadata("If.kt")
public void testIf() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/If.kt");
}
@TestMetadata("IfLParenth.kt")
public void testIfLParenth() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/IfLParenth.kt");
}
@TestMetadata("IfParansOnNextLine.kt")
public void testIfParansOnNextLine() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/IfParansOnNextLine.kt");
}
@TestMetadata("IfSpace.kt")
public void testIfSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/IfSpace.kt");
}
@TestMetadata("Init.kt")
public void testInit() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Init.kt");
}
@TestMetadata("NoSpaceAfterNull.kt")
public void testNoSpaceAfterNull() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/NoSpaceAfterNull.kt");
}
@TestMetadata("QualifiedReturnNonUnit.kt")
public void testQualifiedReturnNonUnit() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/QualifiedReturnNonUnit.kt");
}
@TestMetadata("QualifiedReturnNonUnitExplicit.kt")
public void testQualifiedReturnNonUnitExplicit() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/QualifiedReturnNonUnitExplicit.kt");
}
@TestMetadata("QualifiedReturnUnit.kt")
public void testQualifiedReturnUnit() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/QualifiedReturnUnit.kt");
}
@TestMetadata("ReturnEmptyList.kt")
public void testReturnEmptyList() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnEmptyList.kt");
}
@TestMetadata("ReturnInEmptyType.kt")
public void testReturnInEmptyType() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnInEmptyType.kt");
}
@TestMetadata("ReturnInProperty.kt")
public void testReturnInProperty() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnInProperty.kt");
}
@TestMetadata("ReturnInTypeFunction.kt")
public void testReturnInTypeFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnInTypeFunction.kt");
}
@TestMetadata("ReturnInUnit.kt")
public void testReturnInUnit() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnInUnit.kt");
}
@TestMetadata("ReturnNull.kt")
public void testReturnNull() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/ReturnNull.kt");
}
@TestMetadata("Setter1.kt")
public void testSetter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Setter1.kt");
}
@TestMetadata("Setter2.kt")
public void testSetter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Setter2.kt");
}
@TestMetadata("SpaceAfterImport.kt")
public void testSpaceAfterImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/SpaceAfterImport.kt");
}
@TestMetadata("Try.kt")
public void testTry() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/Try.kt");
}
@TestMetadata("UseSiteAnnotationTarget1.kt")
public void testUseSiteAnnotationTarget1() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/UseSiteAnnotationTarget1.kt");
}
@TestMetadata("UseSiteAnnotationTarget2.kt")
public void testUseSiteAnnotationTarget2() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/UseSiteAnnotationTarget2.kt");
}
@TestMetadata("UseSiteAnnotationTarget3.kt")
public void testUseSiteAnnotationTarget3() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/UseSiteAnnotationTarget3.kt");
}
@TestMetadata("While.kt")
public void testWhile() throws Exception {
runTest("idea/idea-completion/testData/handlers/keywords/While.kt");
}
}
@@ -131,8 +131,7 @@ public class PerformanceNewJavaToKotlinCopyPasteConversionTestGenerated extends
@TestMetadata("Imports2.java") @TestMetadata("Imports2.java")
public void testImports2() throws Exception { public void testImports2() throws Exception {
// TODO: commented until rr/darthorimar/range-marker-fix is merged runTest("idea/testData/copyPaste/conversion/Imports2.java");
// runTest("idea/testData/copyPaste/conversion/Imports2.java");
} }
@TestMetadata("Imports3.java") @TestMetadata("Imports3.java")
@@ -0,0 +1,70 @@
/*
* 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.junit.AfterClass
import org.junit.BeforeClass
class PerformanceProjectsTest : AbstractPerformanceProjectsTest() {
companion object {
@JvmStatic
var warmedUp: Boolean = false
@JvmStatic
val hwStats: Stats = Stats("helloWorld project")
@BeforeClass
@JvmStatic
fun setup() {
// things to execute once and keep around for the class
}
@AfterClass
@JvmStatic
fun teardown() {
hwStats.close()
}
}
override fun setUp() {
super.setUp()
// warm up: open simple small project
if (!warmedUp) {
val project = innerPerfOpenProject("helloKotlin", hwStats, "warm-up")
val perfHighlightFile = perfHighlightFile(project, "src/HelloMain.kt", hwStats, "warm-up")
assertTrue("kotlin project has been not imported properly", perfHighlightFile.isNotEmpty())
closeProject(project)
warmedUp = true
}
}
fun testHelloWorldProject() {
tcSuite("Hello world project") {
perfOpenProject("helloKotlin", hwStats)
// highlight
perfHighlightFile("src/HelloMain.kt", hwStats)
perfHighlightFile("src/HelloMain2.kt", hwStats)
}
}
fun testKotlinProject() {
tcSuite("Kotlin project") {
val stats = Stats("kotlin project")
stats.use {
perfOpenProject("perfTestProject", stats = it, path = "..")
perfHighlightFile("compiler/psi/src/org/jetbrains/kotlin/psi/KtFile.kt", stats = it)
perfHighlightFile("compiler/psi/src/org/jetbrains/kotlin/psi/KtElement.kt", stats = it)
}
}
}
}
@@ -0,0 +1,802 @@
/*
* 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/idea-completion/testData/handlers/smart")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PerformanceSmartCompletionHandlerTestGenerated extends AbstractPerformanceSmartCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("AfterAs.kt")
public void testAfterAs() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AfterAs.kt");
}
@TestMetadata("AfterAs2.kt")
public void testAfterAs2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AfterAs2.kt");
}
@TestMetadata("AfterAs3.kt")
public void testAfterAs3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AfterAs3.kt");
}
@TestMetadata("AfterSafeAs.kt")
public void testAfterSafeAs() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AfterSafeAs.kt");
}
@TestMetadata("AfterVararg.kt")
public void testAfterVararg() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AfterVararg.kt");
}
public void testAllFilesPresentInSmart() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/smart"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AnonymousObject1.kt")
public void testAnonymousObject1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AnonymousObject1.kt");
}
@TestMetadata("AnonymousObject2.kt")
public void testAnonymousObject2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AnonymousObject2.kt");
}
@TestMetadata("AnonymousObject3.kt")
public void testAnonymousObject3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AnonymousObject3.kt");
}
@TestMetadata("AnonymousObjectInsertsImport.kt")
public void testAnonymousObjectInsertsImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AnonymousObjectInsertsImport.kt");
}
@TestMetadata("AnonymousObjectUninferredTypeArgs.kt")
public void testAnonymousObjectUninferredTypeArgs() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AnonymousObjectUninferredTypeArgs.kt");
}
@TestMetadata("ArrayClassLiteral.kt")
public void testArrayClassLiteral() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ArrayClassLiteral.kt");
}
@TestMetadata("AutoCompleteAfterAs1.kt")
public void testAutoCompleteAfterAs1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AutoCompleteAfterAs1.kt");
}
@TestMetadata("AutoCompleteAfterAs2.kt")
public void testAutoCompleteAfterAs2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AutoCompleteAfterAs2.kt");
}
@TestMetadata("AutoCompleteAfterAs3.kt")
public void testAutoCompleteAfterAs3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/AutoCompleteAfterAs3.kt");
}
@TestMetadata("CallableReference1.kt")
public void testCallableReference1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/CallableReference1.kt");
}
@TestMetadata("CallableReference2.kt")
public void testCallableReference2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/CallableReference2.kt");
}
@TestMetadata("CallableReference3.kt")
public void testCallableReference3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/CallableReference3.kt");
}
@TestMetadata("CallableReference4.kt")
public void testCallableReference4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/CallableReference4.kt");
}
@TestMetadata("ClassInClassObject.kt")
public void testClassInClassObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassInClassObject.kt");
}
@TestMetadata("ClassInObject.kt")
public void testClassInObject() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassInObject.kt");
}
@TestMetadata("ClassObjectFieldKeywordName.kt")
public void testClassObjectFieldKeywordName() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassObjectFieldKeywordName.kt");
}
@TestMetadata("ClassObjectMethod1.kt")
public void testClassObjectMethod1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassObjectMethod1.kt");
}
@TestMetadata("ClassObjectMethod2.kt")
public void testClassObjectMethod2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassObjectMethod2.kt");
}
@TestMetadata("ClassObjectMethod3.kt")
public void testClassObjectMethod3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassObjectMethod3.kt");
}
@TestMetadata("ClassObjectMethod4.kt")
public void testClassObjectMethod4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClassObjectMethod4.kt");
}
@TestMetadata("ClosingParenthesis1.kt")
public void testClosingParenthesis1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClosingParenthesis1.kt");
}
@TestMetadata("ClosingParenthesis2.kt")
public void testClosingParenthesis2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ClosingParenthesis2.kt");
}
@TestMetadata("Comma1.kt")
public void testComma1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma1.kt");
}
@TestMetadata("Comma10.kt")
public void testComma10() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma10.kt");
}
@TestMetadata("Comma11.kt")
public void testComma11() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma11.kt");
}
@TestMetadata("Comma2.kt")
public void testComma2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma2.kt");
}
@TestMetadata("Comma3.kt")
public void testComma3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma3.kt");
}
@TestMetadata("Comma4.kt")
public void testComma4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma4.kt");
}
@TestMetadata("Comma5.kt")
public void testComma5() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma5.kt");
}
@TestMetadata("Comma6.kt")
public void testComma6() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma6.kt");
}
@TestMetadata("Comma7.kt")
public void testComma7() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma7.kt");
}
@TestMetadata("Comma8.kt")
public void testComma8() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma8.kt");
}
@TestMetadata("Comma9.kt")
public void testComma9() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Comma9.kt");
}
@TestMetadata("CommaInSuperConstructorCall.kt")
public void testCommaInSuperConstructorCall() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/CommaInSuperConstructorCall.kt");
}
@TestMetadata("ConcreteJavaClass.kt")
public void testConcreteJavaClass() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConcreteJavaClass.kt");
}
@TestMetadata("ConcreteJavaClass2.kt")
public void testConcreteJavaClass2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConcreteJavaClass2.kt");
}
@TestMetadata("ConcreteKClass.kt")
public void testConcreteKClass() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConcreteKClass.kt");
}
@TestMetadata("Constructor.kt")
public void testConstructor() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Constructor.kt");
}
@TestMetadata("ConstructorForGenericType.kt")
public void testConstructorForGenericType() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorForGenericType.kt");
}
@TestMetadata("ConstructorForGenericType2.kt")
public void testConstructorForGenericType2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorForGenericType2.kt");
}
@TestMetadata("ConstructorForJavaClass.kt")
public void testConstructorForJavaClass() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorForJavaClass.kt");
}
@TestMetadata("ConstructorForNullable.kt")
public void testConstructorForNullable() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorForNullable.kt");
}
@TestMetadata("ConstructorInsertsImport.kt")
public void testConstructorInsertsImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorInsertsImport.kt");
}
@TestMetadata("ConstructorInsertsImport2.kt")
public void testConstructorInsertsImport2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorInsertsImport2.kt");
}
@TestMetadata("ConstructorWithKeywordName.kt")
public void testConstructorWithKeywordName() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorWithKeywordName.kt");
}
@TestMetadata("ConstructorWithLambdaParameter1.kt")
public void testConstructorWithLambdaParameter1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorWithLambdaParameter1.kt");
}
@TestMetadata("ConstructorWithLambdaParameter2.kt")
public void testConstructorWithLambdaParameter2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorWithLambdaParameter2.kt");
}
@TestMetadata("ConstructorWithParameters.kt")
public void testConstructorWithParameters() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ConstructorWithParameters.kt");
}
@TestMetadata("DefaultParams.kt")
public void testDefaultParams() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/DefaultParams.kt");
}
@TestMetadata("DoNotEraseBraceOnTab.kt")
public void testDoNotEraseBraceOnTab() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/DoNotEraseBraceOnTab.kt");
}
@TestMetadata("DoNotInsertTypeArguments.kt")
public void testDoNotInsertTypeArguments() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/DoNotInsertTypeArguments.kt");
}
@TestMetadata("DoNotReplaceOnEnter.kt")
public void testDoNotReplaceOnEnter() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/DoNotReplaceOnEnter.kt");
}
@TestMetadata("EnumMember.kt")
public void testEnumMember() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/EnumMember.kt");
}
@TestMetadata("ExclChar.kt")
public void testExclChar() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ExclChar.kt");
}
@TestMetadata("ExtensionFunctionTypeVariable1.kt")
public void testExtensionFunctionTypeVariable1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ExtensionFunctionTypeVariable1.kt");
}
@TestMetadata("ExtensionFunctionTypeVariable2.kt")
public void testExtensionFunctionTypeVariable2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ExtensionFunctionTypeVariable2.kt");
}
@TestMetadata("ForLoopRange.kt")
public void testForLoopRange() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ForLoopRange.kt");
}
@TestMetadata("ForLoopRange2.kt")
public void testForLoopRange2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ForLoopRange2.kt");
}
@TestMetadata("FunctionLiteralParamAlreadyExist.kt")
public void testFunctionLiteralParamAlreadyExist() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/FunctionLiteralParamAlreadyExist.kt");
}
@TestMetadata("GenericFunction.kt")
public void testGenericFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/GenericFunction.kt");
}
@TestMetadata("GetWithBrackets.kt")
public void testGetWithBrackets() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/GetWithBrackets.kt");
}
@TestMetadata("IfCondition.kt")
public void testIfCondition() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/IfCondition.kt");
}
@TestMetadata("IfValue1.kt")
public void testIfValue1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/IfValue1.kt");
}
@TestMetadata("IfValue2.kt")
public void testIfValue2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/IfValue2.kt");
}
@TestMetadata("IfValue3.kt")
public void testIfValue3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/IfValue3.kt");
}
@TestMetadata("IfValueInBlock.kt")
public void testIfValueInBlock() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/IfValueInBlock.kt");
}
@TestMetadata("InElvisOperator.kt")
public void testInElvisOperator() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/InElvisOperator.kt");
}
@TestMetadata("InnerClassInstantiation1.kt")
public void testInnerClassInstantiation1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/InnerClassInstantiation1.kt");
}
@TestMetadata("InnerClassInstantiation2.kt")
public void testInnerClassInstantiation2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/InnerClassInstantiation2.kt");
}
@TestMetadata("InsertTypeArguments.kt")
public void testInsertTypeArguments() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/InsertTypeArguments.kt");
}
@TestMetadata("JavaEnumMemberInsertsImport.kt")
public void testJavaEnumMemberInsertsImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaEnumMemberInsertsImport.kt");
}
@TestMetadata("JavaStaticField.kt")
public void testJavaStaticField() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaStaticField.kt");
}
@TestMetadata("JavaStaticFieldInsertImport.kt")
public void testJavaStaticFieldInsertImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaStaticFieldInsertImport.kt");
}
@TestMetadata("JavaStaticMethod.kt")
public void testJavaStaticMethod() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaStaticMethod.kt");
}
@TestMetadata("JavaStaticMethod2.kt")
public void testJavaStaticMethod2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaStaticMethod2.kt");
}
@TestMetadata("JavaStaticMethodInsertsImport.kt")
public void testJavaStaticMethodInsertsImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/JavaStaticMethodInsertsImport.kt");
}
@TestMetadata("kt10602.kt")
public void testKt10602() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/kt10602.kt");
}
@TestMetadata("kt6179filterTo.kt")
public void testKt6179filterTo() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/kt6179filterTo.kt");
}
@TestMetadata("LambdaValue1.kt")
public void testLambdaValue1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/LambdaValue1.kt");
}
@TestMetadata("LambdaValue2.kt")
public void testLambdaValue2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/LambdaValue2.kt");
}
@TestMetadata("LastNonOptionalParamIsFunction.kt")
public void testLastNonOptionalParamIsFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/LastNonOptionalParamIsFunction.kt");
}
@TestMetadata("LastParamIsFunction.kt")
public void testLastParamIsFunction() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/LastParamIsFunction.kt");
}
@TestMetadata("MergeTail1.kt")
public void testMergeTail1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MergeTail1.kt");
}
@TestMetadata("MergeTail2.kt")
public void testMergeTail2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MergeTail2.kt");
}
@TestMetadata("MergeTail3.kt")
public void testMergeTail3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MergeTail3.kt");
}
@TestMetadata("MergeTail4.kt")
public void testMergeTail4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MergeTail4.kt");
}
@TestMetadata("MultipleArgsIntoBrackets.kt")
public void testMultipleArgsIntoBrackets() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MultipleArgsIntoBrackets.kt");
}
@TestMetadata("MultipleArgsItem.kt")
public void testMultipleArgsItem() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MultipleArgsItem.kt");
}
@TestMetadata("MultipleArgsItemByTab.kt")
public void testMultipleArgsItemByTab() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/MultipleArgsItemByTab.kt");
}
@TestMetadata("NamedArgument1.kt")
public void testNamedArgument1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgument1.kt");
}
@TestMetadata("NamedArgument2.kt")
public void testNamedArgument2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgument2.kt");
}
@TestMetadata("NamedArgument3.kt")
public void testNamedArgument3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgument3.kt");
}
@TestMetadata("NamedArgumentVararg1.kt")
public void testNamedArgumentVararg1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgumentVararg1.kt");
}
@TestMetadata("NamedArgumentVararg2.kt")
public void testNamedArgumentVararg2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgumentVararg2.kt");
}
@TestMetadata("NamedArgumentVararg3.kt")
public void testNamedArgumentVararg3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedArgumentVararg3.kt");
}
@TestMetadata("NamedBooleanArgument.kt")
public void testNamedBooleanArgument() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NamedBooleanArgument.kt");
}
@TestMetadata("NestedDataClass.kt")
public void testNestedDataClass() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NestedDataClass.kt");
}
@TestMetadata("NestedDataClassComma.kt")
public void testNestedDataClassComma() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NestedDataClassComma.kt");
}
@TestMetadata("NullableValue1.kt")
public void testNullableValue1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NullableValue1.kt");
}
@TestMetadata("NullableValue2.kt")
public void testNullableValue2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NullableValue2.kt");
}
@TestMetadata("NullableValue3.kt")
public void testNullableValue3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NullableValue3.kt");
}
@TestMetadata("NullableValueKeepOldArguments.kt")
public void testNullableValueKeepOldArguments() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/NullableValueKeepOldArguments.kt");
}
@TestMetadata("ObjectFromType.kt")
public void testObjectFromType() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ObjectFromType.kt");
}
@TestMetadata("QualifiedCallReplacementBug.kt")
public void testQualifiedCallReplacementBug() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/QualifiedCallReplacementBug.kt");
}
@TestMetadata("QualifiedThisKeywordName1.kt")
public void testQualifiedThisKeywordName1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/QualifiedThisKeywordName1.kt");
}
@TestMetadata("QualifiedThisKeywordName2.kt")
public void testQualifiedThisKeywordName2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/QualifiedThisKeywordName2.kt");
}
@TestMetadata("ReplaceArgument.kt")
public void testReplaceArgument() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/ReplaceArgument.kt");
}
@TestMetadata("SAMExpected1.kt")
public void testSAMExpected1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/SAMExpected1.kt");
}
@TestMetadata("SAMExpected2.kt")
public void testSAMExpected2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/SAMExpected2.kt");
}
@TestMetadata("SecondVararg.kt")
public void testSecondVararg() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/SecondVararg.kt");
}
@TestMetadata("SetWithBrackets.kt")
public void testSetWithBrackets() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/SetWithBrackets.kt");
}
@TestMetadata("TabReplaceComma1.kt")
public void testTabReplaceComma1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceComma1.kt");
}
@TestMetadata("TabReplaceComma2.kt")
public void testTabReplaceComma2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceComma2.kt");
}
@TestMetadata("TabReplaceExpression.kt")
public void testTabReplaceExpression() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceExpression.kt");
}
@TestMetadata("TabReplaceExpression2.kt")
public void testTabReplaceExpression2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceExpression2.kt");
}
@TestMetadata("TabReplaceExpression3.kt")
public void testTabReplaceExpression3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceExpression3.kt");
}
@TestMetadata("TabReplaceExpression4.kt")
public void testTabReplaceExpression4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceExpression4.kt");
}
@TestMetadata("TabReplaceFunctionName1.kt")
public void testTabReplaceFunctionName1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceFunctionName1.kt");
}
@TestMetadata("TabReplaceFunctionName2.kt")
public void testTabReplaceFunctionName2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceFunctionName2.kt");
}
@TestMetadata("TabReplaceFunctionName3.kt")
public void testTabReplaceFunctionName3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceFunctionName3.kt");
}
@TestMetadata("TabReplaceIdentifier.kt")
public void testTabReplaceIdentifier() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceIdentifier.kt");
}
@TestMetadata("TabReplaceOperand.kt")
public void testTabReplaceOperand() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TabReplaceOperand.kt");
}
@TestMetadata("True.kt")
public void testTrue() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/True.kt");
}
@TestMetadata("True2.kt")
public void testTrue2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/True2.kt");
}
@TestMetadata("TypeParameterAfterAs.kt")
public void testTypeParameterAfterAs() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/TypeParameterAfterAs.kt");
}
@TestMetadata("Vararg1.kt")
public void testVararg1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg1.kt");
}
@TestMetadata("Vararg2.kt")
public void testVararg2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg2.kt");
}
@TestMetadata("Vararg3.kt")
public void testVararg3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg3.kt");
}
@TestMetadata("Vararg4.kt")
public void testVararg4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg4.kt");
}
@TestMetadata("Vararg5.kt")
public void testVararg5() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg5.kt");
}
@TestMetadata("Vararg6.kt")
public void testVararg6() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/Vararg6.kt");
}
@TestMetadata("VarargAfterStar.kt")
public void testVarargAfterStar() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/VarargAfterStar.kt");
}
@TestMetadata("VarargWithParameterAfter.kt")
public void testVarargWithParameterAfter() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/VarargWithParameterAfter.kt");
}
@TestMetadata("WhenElse.kt")
public void testWhenElse() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/WhenElse.kt");
}
@TestMetadata("idea/idea-completion/testData/handlers/smart/lambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Lambda extends AbstractPerformanceSmartCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("1.kt")
public void test1() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/1.kt");
}
@TestMetadata("2.kt")
public void test2() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/2.kt");
}
@TestMetadata("3.kt")
public void test3() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/3.kt");
}
@TestMetadata("4.kt")
public void test4() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/4.kt");
}
@TestMetadata("5.kt")
public void test5() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/5.kt");
}
public void testAllFilesPresentInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/smart/lambda"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("InsertImport.kt")
public void testInsertImport() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/InsertImport.kt");
}
@TestMetadata("ParameterNamesSpecified.kt")
public void testParameterNamesSpecified() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/ParameterNamesSpecified.kt");
}
@TestMetadata("ParameterNamesSpecified_NullableType.kt")
public void testParameterNamesSpecified_NullableType() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambda/ParameterNamesSpecified_NullableType.kt");
}
}
@TestMetadata("idea/idea-completion/testData/handlers/smart/lambdaSignature")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LambdaSignature extends AbstractPerformanceSmartCompletionHandlerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPerfTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInLambdaSignature() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/smart/lambdaSignature"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("NoAdditionalSpace.kt")
public void testNoAdditionalSpace() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambdaSignature/NoAdditionalSpace.kt");
}
@TestMetadata("Simple.kt")
public void testSimple() throws Exception {
runTest("idea/idea-completion/testData/handlers/smart/lambdaSignature/Simple.kt");
}
}
}
@@ -7,27 +7,122 @@ package org.jetbrains.kotlin.idea.perf
import org.jetbrains.kotlin.idea.perf.WholeProjectPerformanceTest.Companion.nsToMs import org.jetbrains.kotlin.idea.perf.WholeProjectPerformanceTest.Companion.nsToMs
import java.io.* import java.io.*
import kotlin.math.pow
import kotlin.math.sqrt
import kotlin.system.measureNanoTime import kotlin.system.measureNanoTime
class Stats(name: String = "") : Closeable { class Stats(val name: String = "", val header: Array<String> = arrayOf("Name", "ValueMS", "StdDev")) : Closeable {
private val statsFile: File = File("build/stats$name.csv").absoluteFile private val statsFile: File =
File("build/stats${if (name.isNotEmpty()) "-${name.toLowerCase().replace(' ', '-')}" else ""}.csv")
.absoluteFile
private val statsOutput: BufferedWriter private val statsOutput: BufferedWriter
init { init {
statsOutput = statsFile.bufferedWriter() statsOutput = statsFile.bufferedWriter()
statsOutput.appendln("File, ProcessID, Time") statsOutput.appendln(header.joinToString())
}
private fun append(values: Array<Any>) {
if (values.size != header.size) {
throw IllegalArgumentException("Expected ${header.size} values, actual ${values.size} values")
}
with(statsOutput) {
appendln(values.joinToString { it.toString() })
flush()
}
} }
fun append(file: String, id: String, nanoTime: Long) { fun append(file: String, id: String, nanoTime: Long) {
statsOutput.appendln(buildString { append(arrayOf(file, id, nanoTime.nsToMs))
append(file) }
append(", ")
append(id) fun <T, K> perfTest(
append(", ") testName: String,
append(nanoTime.nsToMs) warmUpIterations: Int = 3,
}) iterations: Int = 10,
statsOutput.flush() setUp: () -> T? = { null },
test: (t: T?) -> K,
tearDown: (t: K?) -> Unit = {}
) {
val namePrefix = "$name: $testName"
val timingsNs = LongArray(iterations)
val errors = Array<Throwable?>(iterations, init = { null })
tcSuite(namePrefix) {
for (attempt in 0 until warmUpIterations) {
val n = "$namePrefix warm-up #$attempt"
println("##teamcity[testStarted name='$n' captureStandardOutput='true']")
try {
val setupValue: T? = setUp()
var value: K? = null
var spentNs: Long = 0
try {
spentNs = measureNanoTime {
value = test(setupValue)
}
} catch (t: Throwable) {
println("error at $n:")
tcPrintErrors(n, listOf(t))
} finally {
tearDown(value)
}
val spentMs = spentNs.nsToMs
println("##teamcity[buildStatisticValue key='$n' value='$spentMs']")
println("##teamcity[testFinished name='$n' duration='$spentMs']")
} catch (t: Throwable) {
println("error at $n:")
tcPrintErrors(n, listOf(t))
throw t
}
}
try {
for (attempt in 0 until iterations) {
val setupValue: T? = setUp()
var value: K? = null
try {
val spentNs = measureNanoTime {
value = test(setupValue)
}
timingsNs[attempt] = spentNs
} catch (t: Throwable) {
println("error at $namePrefix #$attempt:")
errors[attempt] = t
} finally {
tearDown(value)
}
}
} catch (t: Throwable) {
println("error at $namePrefix:")
tcPrintErrors(namePrefix, listOf(t))
}
val meanNs = timingsNs.average()
val meanMs = meanNs.toLong().nsToMs
val stdDivMs = (sqrt(
timingsNs.fold(0.0,
{ accumulator, next -> accumulator + (1.0 * (next - meanMs)).pow(2.0) })
) / timingsNs.size).toLong().nsToMs
for (attempt in 0 until iterations) {
val n = "$namePrefix #$attempt"
println("##teamcity[testStarted name='$n' captureStandardOutput='true']")
if (errors[attempt] != null) {
tcPrintErrors(n, listOf(errors[attempt]!!))
}
val spentMs = timingsNs[attempt].nsToMs
println("##teamcity[buildStatisticValue key='$n' value='$spentMs']")
println("##teamcity[testFinished name='$n' duration='$spentMs']")
}
println("##teamcity[buildStatisticValue key='$namePrefix' value='$meanMs']")
println("##teamcity[buildStatisticValue key='$namePrefix stdDev' value='${stdDivMs}']")
append(arrayOf(namePrefix, meanMs, stdDivMs))
}
} }
override fun close() { override fun close() {
@@ -45,6 +140,11 @@ inline fun tcSuite(name: String, block: () -> Unit) {
inline fun tcTest(name: String, block: () -> Pair<Long, List<Throwable>>) { inline fun tcTest(name: String, block: () -> Pair<Long, List<Throwable>>) {
println("##teamcity[testStarted name='$name' captureStandardOutput='true']") println("##teamcity[testStarted name='$name' captureStandardOutput='true']")
val (time, errors) = block() val (time, errors) = block()
tcPrintErrors(name, errors)
println("##teamcity[testFinished name='$name' duration='$time']")
}
fun tcPrintErrors(name: String, errors: List<Throwable>) {
if (errors.isNotEmpty()) { if (errors.isNotEmpty()) {
val detailsWriter = StringWriter() val detailsWriter = StringWriter()
val errorDetailsPrintWriter = PrintWriter(detailsWriter) val errorDetailsPrintWriter = PrintWriter(detailsWriter)
@@ -56,40 +156,6 @@ inline fun tcTest(name: String, block: () -> Pair<Long, List<Throwable>>) {
val details = detailsWriter.toString() val details = detailsWriter.toString()
println("##teamcity[testFailed name='$name' message='Exceptions reported' details='${details.tcEscape()}']") println("##teamcity[testFailed name='$name' message='Exceptions reported' details='${details.tcEscape()}']")
} }
println("##teamcity[testFinished name='$name' duration='$time']")
}
inline fun tcSimplePerfTest(file: String, name: String, stats: Stats, block: () -> Unit) {
var spentMs = 0L
tcTest(name) {
val errors = mutableListOf<Throwable>()
val spentNs = measureNanoTime {
try {
block()
} catch (t: Throwable) {
errors += t
}
}
stats.append(file, name, spentNs)
spentMs = spentNs.nsToMs
spentMs to errors
}
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 { fun String.tcEscape(): String {
@@ -34,7 +34,7 @@ import java.io.*
abstract class WholeProjectPerformanceTest : DaemonAnalyzerTestCase(), WholeProjectFileProvider { abstract class WholeProjectPerformanceTest : DaemonAnalyzerTestCase(), WholeProjectFileProvider {
private val rootProjectFile: File = File("../perfTestProject").absoluteFile private val rootProjectFile: File = File("../perfTestProject").absoluteFile
private val perfStats: Stats = Stats() private val perfStats: Stats = Stats(name = "whole", header = arrayOf("File", "ProcessID", "Time"))
private val tmp = rootProjectFile private val tmp = rootProjectFile
override fun isStressTest(): Boolean = false override fun isStressTest(): Boolean = false
@@ -0,0 +1,30 @@
/*
* 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.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.EdtTestUtil
import com.intellij.util.ThrowableRunnable
fun commitAllDocuments() {
ProjectManagerEx.getInstanceEx().openProjects.forEach { project ->
val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase
EdtTestUtil.runInEdtAndWait(ThrowableRunnable {
psiDocumentManagerBase.clearUncommittedDocuments()
psiDocumentManagerBase.commitAllDocuments()
})
}
}
fun closeProject(project: Project) {
commitAllDocuments()
val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProject(project, true)
}
@@ -0,0 +1,30 @@
/*
* 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.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.EdtTestUtil
import com.intellij.util.ThrowableRunnable
fun commitAllDocuments() {
ProjectManagerEx.getInstanceEx().openProjects.forEach { project ->
val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase
EdtTestUtil.runInEdtAndWait(ThrowableRunnable {
psiDocumentManagerBase.clearUncommittedDocuments()
psiDocumentManagerBase.commitAllDocuments()
})
}
}
fun closeProject(project: Project) {
commitAllDocuments()
val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.closeAndDispose(project)
}