From 543efffa5c7d6f1b02578c545edfb326e125ac04 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Thu, 2 Jul 2020 17:10:57 +0200 Subject: [PATCH] Turn off stability check for PerformanceTypingIndentationTest --- ...bstractPerformanceTypingIndentationTest.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceTypingIndentationTest.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceTypingIndentationTest.kt index 546c2748bc8..2b1c89ec0d5 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceTypingIndentationTest.kt +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/AbstractPerformanceTypingIndentationTest.kt @@ -10,7 +10,7 @@ import com.intellij.openapi.actionSystem.IdeActions import com.intellij.openapi.util.io.FileUtil import com.intellij.testFramework.EditorTestUtil import org.jetbrains.kotlin.formatter.FormatSettingsUtil -import org.jetbrains.kotlin.idea.test.KotlinLightPlatformCodeInsightTestCase +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File @@ -18,19 +18,22 @@ import java.io.File /** * inspired by @see [org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase] */ -abstract class AbstractPerformanceTypingIndentationTest : KotlinLightPlatformCodeInsightTestCase() { +abstract class AbstractPerformanceTypingIndentationTest : KotlinLightCodeInsightFixtureTestCase() { companion object { @JvmStatic val stats: Stats = Stats("typing-indentation") } - protected fun doPerfTest(filePath: String) { + protected fun doPerfTest(unused: String) { val testName = getTestName(false) + + myFixture.testDataPath = testDataPath + val testDataFile = testDataFile() + val filePath = testDataFile.path val testFileName = filePath.substring(0, filePath.indexOf(".")) val testFileExtension = filePath.substring(filePath.lastIndexOf(".")) - val originFilePath = testFileName + testFileExtension val afterFilePath = "$testFileName.after$testFileExtension" - val originalFileText = FileUtil.loadFile(File(originFilePath), true) + val originalFileText = FileUtil.loadFile(testDataFile, true) try { val configurator = FormatSettingsUtil.createConfigurator(originalFileText, CodeStyle.getSettings(project)) @@ -39,13 +42,14 @@ abstract class AbstractPerformanceTypingIndentationTest : KotlinLightPlatformCod performanceTest { name(testName) stats(stats) - warmUpIterations(30) - iterations(50) + checkStability(false) // [VD] TODO: seems it could be some leakages here + warmUpIterations(20) + iterations(30) setUp { - configureByFile(originFilePath) + myFixture.configureByFile(testDataFile.name) } test { - executeAction(IdeActions.ACTION_EDITOR_ENTER) + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ENTER) } tearDown { val actualTextWithCaret = StringBuilder(editor.document.text).insert( @@ -53,6 +57,9 @@ abstract class AbstractPerformanceTypingIndentationTest : KotlinLightPlatformCod EditorTestUtil.CARET_TAG ).toString() + // to avoid VFS refresh + myFixture.performEditorAction(IdeActions.ACTION_UNDO) + KotlinTestUtils.assertEqualsToFile(File(afterFilePath), actualTextWithCaret) } } @@ -61,5 +68,4 @@ abstract class AbstractPerformanceTypingIndentationTest : KotlinLightPlatformCod } } - override fun getTestDataPath(): String = "" } \ No newline at end of file