[kotlin] k2: additional testdata for extract function

^KTIJ-26744 fixed

GitOrigin-RevId: f60c64bb1e011d075bb875f8d20c78820f6a192d
This commit is contained in:
Anna Kozlova
2024-03-27 19:29:55 +00:00
committed by intellij-monorepo-bot
parent cde5fae5d7
commit da942eb388
4 changed files with 30 additions and 0 deletions
@@ -1494,6 +1494,11 @@ public abstract class ExtractionTestGenerated extends AbstractExtractionTest {
runTest("testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt");
}
@TestMetadata("runExpression.kt")
public void testRunExpression() throws Exception {
runTest("testData/refactoring/extractFunction/controlFlow/outputValues/runExpression.kt");
}
@TestMetadata("singleOutputValue.kt")
public void testSingleOutputValue() throws Exception {
runTest("testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValue.kt");
@@ -0,0 +1,9 @@
fun test () {
val nullable: String? = "1"
val result = <selection>nullable.run {
this!!
toInt()
}</selection>
val int: Int = result
}
// IGNORE_K1
@@ -0,0 +1,11 @@
fun test () {
val nullable: String? = "1"
val result = i(nullable)
val int: Int = result
}
private fun String.i(nullable: String?): Int = nullable.run {
this!!
toInt()
}
// IGNORE_K1
@@ -715,6 +715,11 @@ public abstract class K2IntroduceFunctionTestGenerated extends AbstractK2Introdu
runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt");
}
@TestMetadata("runExpression.kt")
public void testRunExpression() throws Exception {
runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/runExpression.kt");
}
@TestMetadata("singleOutputValue.kt")
public void testSingleOutputValue() throws Exception {
runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValue.kt");