Update file name replace in QuickFix tests
This commit is contained in:
@@ -94,22 +94,22 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
||||||
val contents = StringUtil.convertLineSeparators(fileText)
|
val contents = StringUtil.convertLineSeparators(fileText)
|
||||||
var filePath = testFile.canonicalFile.name
|
var fileName = testFile.canonicalFile.name
|
||||||
val putIntoPackageFolder = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// FORCE_PACKAGE_FOLDER") != null
|
val putIntoPackageFolder = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// FORCE_PACKAGE_FOLDER") != null
|
||||||
if (putIntoPackageFolder) {
|
if (putIntoPackageFolder) {
|
||||||
filePath = getPathAccordingToPackage(filePath, contents)
|
fileName = getPathAccordingToPackage(fileName, contents)
|
||||||
myFixture.addFileToProject(filePath, contents)
|
myFixture.addFileToProject(fileName, contents)
|
||||||
myFixture.configureByFile(filePath)
|
myFixture.configureByFile(fileName)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myFixture.configureByText(filePath, contents)
|
myFixture.configureByText(fileName, contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUnexpectedActions()
|
checkForUnexpectedActions()
|
||||||
|
|
||||||
configExtra(fileText)
|
configExtra(fileText)
|
||||||
|
|
||||||
applyAction(contents, filePath)
|
applyAction(contents, fileName)
|
||||||
|
|
||||||
UsefulTestCase.assertEmpty(expectedErrorMessage)
|
UsefulTestCase.assertEmpty(expectedErrorMessage)
|
||||||
}
|
}
|
||||||
@@ -136,8 +136,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
}, "", "")
|
}, "", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun applyAction(contents: String, testFullPath: String) {
|
private fun applyAction(contents: String, fileName: String) {
|
||||||
val fileName = testFullPath.substringAfterLast(File.separatorChar, "")
|
|
||||||
val actionHint = ActionHint.parse(myFixture.file, contents.replace("\${file}", fileName, ignoreCase = true))
|
val actionHint = ActionHint.parse(myFixture.file, contents.replace("\${file}", fileName, ignoreCase = true))
|
||||||
val intention = findActionWithText(actionHint.expectedText)
|
val intention = findActionWithText(actionHint.expectedText)
|
||||||
if (actionHint.shouldPresent()) {
|
if (actionHint.shouldPresent()) {
|
||||||
@@ -150,11 +149,11 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
UIUtil.dispatchAllInvocationEvents()
|
UIUtil.dispatchAllInvocationEvents()
|
||||||
|
|
||||||
if (!shouldBeAvailableAfterExecution()) {
|
if (!shouldBeAvailableAfterExecution()) {
|
||||||
assertNull("Action '${actionHint.expectedText}' is still available after its invocation in test " + testFullPath,
|
assertNull("Action '${actionHint.expectedText}' is still available after its invocation in test " + fileName,
|
||||||
findActionWithText(actionHint.expectedText))
|
findActionWithText(actionHint.expectedText))
|
||||||
}
|
}
|
||||||
|
|
||||||
myFixture.checkResultByFile(File(testFullPath).name + ".after")
|
myFixture.checkResultByFile(File(fileName).name + ".after")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assertNull("Action with text ${actionHint.expectedText} is present, but should not", intention)
|
assertNull("Action with text ${actionHint.expectedText} is present, but should not", intention)
|
||||||
|
|||||||
Reference in New Issue
Block a user