diff --git a/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt new file mode 100644 index 00000000000..50396595086 --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt @@ -0,0 +1,4 @@ +// EXTRACTION_TARGET: property with initializer +class A(val a: Int = 1 + 2) { + +} \ No newline at end of file diff --git a/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt.after b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt.after new file mode 100644 index 00000000000..9f00cb3dade --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt.after @@ -0,0 +1,6 @@ +private val i = 1 + 2 + +// EXTRACTION_TARGET: property with initializer +class A(val a: Int = i) { + +} \ No newline at end of file diff --git a/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt new file mode 100644 index 00000000000..5b801f20b77 --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt @@ -0,0 +1,6 @@ +// EXTRACTION_TARGET: property with initializer +class A { + fun foo(a: Int = 1 + 2) { + + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt.after b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt.after new file mode 100644 index 00000000000..5cddc99dd75 --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt.after @@ -0,0 +1,8 @@ +// EXTRACTION_TARGET: property with initializer +class A { + private val i = 1 + 2 + + fun foo(a: Int = i) { + + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java index 215de5562bb..4bbcdeec8f8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java @@ -1935,6 +1935,18 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/refactoring/introduceProperty"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("extractFromDefaultValueInConstructor.kt") + public void testExtractFromDefaultValueInConstructor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceProperty/extractFromDefaultValueInConstructor.kt"); + doIntroducePropertyTest(fileName); + } + + @TestMetadata("extractFromDefaultValueInFun.kt") + public void testExtractFromDefaultValueInFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceProperty/extractFromDefaultValueInFun.kt"); + doIntroducePropertyTest(fileName); + } + @TestMetadata("extractLazyMultipleExpressions.kt") public void testExtractLazyMultipleExpressions() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceProperty/extractLazyMultipleExpressions.kt");