Minor: activate copy actual to expected file
This commit is contained in:
+5
-2
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.io.FileUtil
|
|||||||
import com.intellij.refactoring.util.CommonRefactoringUtil
|
import com.intellij.refactoring.util.CommonRefactoringUtil
|
||||||
import com.intellij.testFramework.PlatformTestUtil
|
import com.intellij.testFramework.PlatformTestUtil
|
||||||
import com.intellij.testFramework.TestActionEvent
|
import com.intellij.testFramework.TestActionEvent
|
||||||
|
import junit.framework.ComparisonFailure
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
@@ -58,6 +59,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
val fileText = FileUtil.loadFile(File(path), true)
|
val fileText = FileUtil.loadFile(File(path), true)
|
||||||
|
|
||||||
val conflictFile = File("$path.messages")
|
val conflictFile = File("$path.messages")
|
||||||
|
val afterFile = File("$path.after")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
@@ -89,13 +91,14 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
assert(!conflictFile.exists()) { "Conflict file $conflictFile should not exist" }
|
assert(!conflictFile.exists()) { "Conflict file $conflictFile should not exist" }
|
||||||
|
|
||||||
if (isForced || isApplicableExpected) {
|
if (isForced || isApplicableExpected) {
|
||||||
val afterFile = File("$path.after")
|
|
||||||
TestCase.assertTrue(afterFile.exists())
|
TestCase.assertTrue(afterFile.exists())
|
||||||
myFixture.checkResult(FileUtil.loadFile(afterFile, true))
|
myFixture.checkResult(FileUtil.loadFile(afterFile, true))
|
||||||
|
|
||||||
checkExtra()
|
checkExtra()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (e: ComparisonFailure) {
|
||||||
|
KotlinTestUtils.assertEqualsToFile(afterFile, myFixture.editor)
|
||||||
|
}
|
||||||
catch (e: CommonRefactoringUtil.RefactoringErrorHintException) {
|
catch (e: CommonRefactoringUtil.RefactoringErrorHintException) {
|
||||||
KotlinTestUtils.assertEqualsToFile(conflictFile, e.message!!)
|
KotlinTestUtils.assertEqualsToFile(conflictFile, e.message!!)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user