Simplified CodeTransformationTest. Only one doTest method remains, intention class is moved to test data. Merged other intention tests (SpecifyTypeExplicitlyTest, ConvertToBlock/ExpressionBodyTest) into this one.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction
|
||||
@@ -1,2 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo(): String = "abc"
|
||||
@@ -1,4 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo() = bar()
|
||||
|
||||
fun bar() { }
|
||||
@@ -1,3 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
val foo: String
|
||||
get() = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
trait I {
|
||||
fun foo(): String
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
trait I {
|
||||
fun foo(): String
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
var a = 1
|
||||
var b = 2
|
||||
|
||||
fun foo() {
|
||||
<caret>a = b
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
var a = 1
|
||||
var b = 2
|
||||
|
||||
fun foo() {
|
||||
<caret>a = b
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>val v = 1
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() = <caret>"abc"
|
||||
@@ -1,7 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
|
||||
fun bar(): String = "abc"
|
||||
@@ -1,6 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo(): String {
|
||||
val v = 1
|
||||
<caret>return "abc"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>return
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
<caret>while(true) { }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
<caret>val v = 1
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
return bar() ?: return "a"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
if (p) {
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit = throw UnsupportedOperationException()
|
||||
@@ -0,0 +1,3 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() = <caret>"abc"
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Nothing {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Nothing = throw UnsupportedOperationException()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun <caret>foo(): String {
|
||||
return "abc"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun foo(): String = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo() = bar()
|
||||
|
||||
fun bar() { }
|
||||
@@ -0,0 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
|
||||
fun bar(): String = "abc"
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit = throw UnsupportedOperationException()
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(handler: () -> Unit) { }
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
val foo: String
|
||||
<caret>get() {
|
||||
return "abc"
|
||||
@@ -0,0 +1,2 @@
|
||||
val foo: String
|
||||
get() = "abc"
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(): String {
|
||||
val v = 1
|
||||
<caret>return "abc"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
<caret>return
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
<caret>while(true) { }
|
||||
}
|
||||
Reference in New Issue
Block a user