mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin][indent] deduplicate tests
^KTIJ-21962 ^FL-11758 GitOrigin-RevId: ce9e4e36b71b8f02196b358b34df897119a1b721
This commit is contained in:
committed by
intellij-monorepo-bot
parent
53254db32c
commit
708c3f9749
+14
-6
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.formatter
|
||||
|
||||
import com.intellij.injected.editor.EditorWindow
|
||||
@@ -62,7 +62,8 @@ abstract class AbstractEnterHandlerTest : KotlinLightPlatformCodeInsightTestCase
|
||||
doNewlineTest(
|
||||
originalFile.path, afterFilePath,
|
||||
withoutCustomLineIndentProvider = withoutCustomLineIndentProvider,
|
||||
ignoreFormatter = ignoreFormatter
|
||||
ignoreFormatter = ignoreFormatter,
|
||||
isInvertedTest = inverted,
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -72,10 +73,11 @@ abstract class AbstractEnterHandlerTest : KotlinLightPlatformCodeInsightTestCase
|
||||
beforeFilePath: String,
|
||||
afterFilePath: String,
|
||||
withoutCustomLineIndentProvider: Boolean,
|
||||
ignoreFormatter: Boolean
|
||||
ignoreFormatter: Boolean,
|
||||
isInvertedTest: Boolean,
|
||||
) {
|
||||
KotlinLineIndentProvider.useFormatter = true
|
||||
typeAndCheck(beforeFilePath, afterFilePath, "with FormatterBasedLineIndentProvider", ignoreFormatter)
|
||||
typeAndCheck(beforeFilePath, afterFilePath, "with FormatterBasedLineIndentProvider", ignoreFormatter, isInvertedTest)
|
||||
KotlinLineIndentProvider.useFormatter = false
|
||||
|
||||
if (!withoutCustomLineIndentProvider) {
|
||||
@@ -100,7 +102,13 @@ abstract class AbstractEnterHandlerTest : KotlinLightPlatformCodeInsightTestCase
|
||||
)
|
||||
}
|
||||
|
||||
private fun typeAndCheck(beforeFilePath: String, afterFilePath: String, errorMessage: String, invertResult: Boolean = false) {
|
||||
private fun typeAndCheck(
|
||||
beforeFilePath: String,
|
||||
afterFilePath: String,
|
||||
errorMessage: String,
|
||||
invertResult: Boolean = false,
|
||||
isInvertedTest: Boolean = false,
|
||||
) {
|
||||
configureByFile(beforeFilePath)
|
||||
executeAction(IdeActions.ACTION_EDITOR_ENTER)
|
||||
val editor = editor.safeAs<EditorWindow>()?.delegate ?: editor
|
||||
@@ -114,7 +122,7 @@ abstract class AbstractEnterHandlerTest : KotlinLightPlatformCodeInsightTestCase
|
||||
}
|
||||
|
||||
if (invertResult)
|
||||
Assert.assertTrue("Remove // IGNORE_FORMATTER", result.isFailure)
|
||||
Assert.assertTrue("Remove // IGNORE_FORMATTER", isInvertedTest || result.isFailure)
|
||||
else
|
||||
result.getOrThrow()
|
||||
}
|
||||
|
||||
+10
-10
@@ -844,21 +844,11 @@ public abstract class EnterHandlerTestGenerated extends AbstractEnterHandlerTest
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIf.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionUnfinishedInIfInv.after.kt")
|
||||
public void testInBinaryExpressionUnfinishedInIfInv() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIfInv.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesis.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesisInv.after.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesisInv() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesisInv.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InExpressionsParentheses.after.kt")
|
||||
public void testInExpressionsParentheses() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InExpressionsParentheses.after.kt");
|
||||
@@ -1981,6 +1971,16 @@ public abstract class EnterHandlerTestGenerated extends AbstractEnterHandlerTest
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinished.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionUnfinishedInIf.after.inv.kt")
|
||||
public void testInBinaryExpressionUnfinishedInIf() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIf.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InExpressionsParenthesesBeforeOperand.after.inv.kt")
|
||||
public void testInExpressionsParenthesesBeforeOperand() throws Exception {
|
||||
runTest("testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InExpressionsParenthesesBeforeOperand.after.inv.kt");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
if (true &&
|
||||
<caret>)
|
||||
<caret>)
|
||||
}
|
||||
|
||||
// SET_FALSE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
fun test() {
|
||||
if (true &&
|
||||
<caret>)
|
||||
<caret>)
|
||||
}
|
||||
|
||||
// SET_TRUE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
// SET_FALSE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
// IGNORE_FORMATTER
|
||||
+2
-1
@@ -2,4 +2,5 @@ fun test() {
|
||||
if (true &&<caret>)
|
||||
}
|
||||
|
||||
// SET_TRUE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
// SET_FALSE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
// IGNORE_FORMATTER
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
fun test() {
|
||||
if (true &&<caret>)
|
||||
}
|
||||
|
||||
// SET_FALSE: CONTINUATION_INDENT_IN_IF_CONDITIONS
|
||||
// IGNORE_FORMATTER
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
val somelong = 3 + 4 - (3 +
|
||||
<caret>)
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||
// IGNORE_FORMATTER
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
val somelong = 3 + 4 - (3 +
|
||||
<caret>)
|
||||
|
||||
// SET_FALSE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
val somelong = 3 + 4 - (3 + <caret>)
|
||||
|
||||
// SET_FALSE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||
+10
-10
@@ -844,21 +844,11 @@ public abstract class PerformanceTypingIndentationTestGenerated extends Abstract
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIf.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionUnfinishedInIfInv.after.kt")
|
||||
public void testInBinaryExpressionUnfinishedInIfInv() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIfInv.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesis.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesisInv.after.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesisInv() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesisInv.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InExpressionsParentheses.after.kt")
|
||||
public void testInExpressionsParentheses() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InExpressionsParentheses.after.kt");
|
||||
@@ -1981,6 +1971,16 @@ public abstract class PerformanceTypingIndentationTestGenerated extends Abstract
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinished.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionUnfinishedInIf.after.inv.kt")
|
||||
public void testInBinaryExpressionUnfinishedInIf() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionUnfinishedInIf.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt")
|
||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InExpressionsParenthesesBeforeOperand.after.inv.kt")
|
||||
public void testInExpressionsParenthesesBeforeOperand() throws Exception {
|
||||
runTest("../idea/tests/testData/editor/enterHandler/emptyParenthesisInBinaryExpression/InExpressionsParenthesesBeforeOperand.after.inv.kt");
|
||||
|
||||
Reference in New Issue
Block a user