Fix tests for move: check applicability from changed text
Presentation status has stopped working after https://github.com/JetBrains/intellij-community/commit/18ce2c6070667608d9bf5a18926778187564fd19
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
<caret>init {
|
<caret>init {
|
||||||
|
// First
|
||||||
}
|
}
|
||||||
init {
|
init {
|
||||||
|
// Second
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
init {
|
init {
|
||||||
|
// Second
|
||||||
}
|
}
|
||||||
<caret>init {
|
<caret>init {
|
||||||
|
// First
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
init {
|
init {
|
||||||
|
// First
|
||||||
}
|
}
|
||||||
<caret>init {
|
<caret>init {
|
||||||
|
// Second
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
<caret>init {
|
<caret>init {
|
||||||
|
// Second
|
||||||
}
|
}
|
||||||
init {
|
init {
|
||||||
|
// First
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b:<caret> Int,
|
b:<caret> Int,
|
||||||
a: Int,
|
a: Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
a: Int,
|
a: Int,
|
||||||
b:<caret> Int,
|
b:<caret> Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int,
|
b: Int,
|
||||||
<caret>a: Int,
|
<caret>a: Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int,
|
b: Int,
|
||||||
c: Int,
|
c: Int,
|
||||||
<caret>a: Int
|
<caret>a: Int
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
a: Int,
|
a: Int,
|
||||||
b:<caret> Int,
|
b:<caret> Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b:<caret> Int,
|
b:<caret> Int,
|
||||||
a: Int,
|
a: Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int,
|
b: Int,
|
||||||
c: Int
|
c: Int
|
||||||
<caret>a: Int,
|
<caret>a: Int,
|
||||||
|
|||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int,
|
b: Int,
|
||||||
<caret>a: Int,
|
<caret>a: Int,
|
||||||
c: Int
|
c: Int
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
// MOVE: down
|
// MOVE: down
|
||||||
// IS_APPLICABLE: false
|
// IS_APPLICABLE: false
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int,
|
b: Int,
|
||||||
c: Int
|
c: Int
|
||||||
<caret>a: Int,
|
<caret>a: Int,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
// MOVE: up
|
// MOVE: up
|
||||||
// IS_APPLICABLE: false
|
// IS_APPLICABLE: false
|
||||||
class A {
|
class A {
|
||||||
fun foo<T,
|
fun <T, U, W> foo(
|
||||||
U,
|
|
||||||
W>(
|
|
||||||
b: Int<caret>,
|
b: Int<caret>,
|
||||||
c: Int
|
c: Int
|
||||||
a: Int,
|
a: Int,
|
||||||
|
|||||||
+7
-5
@@ -99,13 +99,15 @@ abstract class AbstractCodeMoverTest : LightCodeInsightTestCase() {
|
|||||||
val editor = LightPlatformCodeInsightTestCase.getEditor()
|
val editor = LightPlatformCodeInsightTestCase.getEditor()
|
||||||
val dataContext = LightPlatformCodeInsightTestCase.getCurrentEditorDataContext()
|
val dataContext = LightPlatformCodeInsightTestCase.getCurrentEditorDataContext()
|
||||||
|
|
||||||
val presentation = Presentation()
|
val before = editor.document.text
|
||||||
action.update(editor, presentation, dataContext)
|
runWriteAction { action.actionPerformed(editor, dataContext) }
|
||||||
TestCase.assertEquals(isApplicableExpected, presentation.isEnabled)
|
|
||||||
|
val after = editor.document.text
|
||||||
|
val actionDoesNothing = after == before
|
||||||
|
|
||||||
|
TestCase.assertEquals(isApplicableExpected, !actionDoesNothing)
|
||||||
|
|
||||||
if (isApplicableExpected) {
|
if (isApplicableExpected) {
|
||||||
runWriteAction { action.actionPerformed(editor, dataContext) }
|
|
||||||
|
|
||||||
val afterFilePath = path + ".after"
|
val afterFilePath = path + ".after"
|
||||||
try {
|
try {
|
||||||
checkResultByFile(afterFilePath)
|
checkResultByFile(afterFilePath)
|
||||||
|
|||||||
Reference in New Issue
Block a user