Turn off stability check for PerformanceTypingIndentationTest
This commit is contained in:
+16
-10
@@ -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<Unit, Unit> {
|
||||
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 = ""
|
||||
}
|
||||
Reference in New Issue
Block a user