Use test path relative to testDataPath in fixture.configureByFile to be complaint with 193
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ abstract class AbstractCompletionIncrementalResolveTest : KotlinLightCodeInsight
|
||||
try {
|
||||
val file = File(testPath)
|
||||
val hasCaretMarker = FileUtil.loadFile(file, true).contains("<caret>")
|
||||
myFixture.configureByFile(testPath)
|
||||
myFixture.configureByFile(fileName())
|
||||
|
||||
val document = myFixture.editor.document
|
||||
val beforeMarkerOffset = document.text.indexOf(BEFORE_MARKER)
|
||||
|
||||
+3
@@ -62,6 +62,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
||||
|
||||
protected open val captureExceptions = true
|
||||
|
||||
protected fun testPath(): String =
|
||||
File(testDataPath, fileName()).toString()
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
// We do it here to avoid possible initialization problems
|
||||
|
||||
+2
-1
@@ -59,7 +59,8 @@ abstract class AbstractPerformanceCompletionHandlerTests(
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
protected open fun doPerfTest(testPath: String) {
|
||||
protected open fun doPerfTest(unused: String) {
|
||||
val testPath = testPath()
|
||||
setUpFixture(testPath)
|
||||
|
||||
val tempSettings = CodeStyle.getSettings(project).clone()
|
||||
|
||||
+3
-2
@@ -65,10 +65,11 @@ abstract class AbstractPerformanceCompletionIncrementalResolveTest : KotlinLight
|
||||
}
|
||||
}
|
||||
|
||||
protected fun doPerfTest(testPath: String) {
|
||||
protected fun doPerfTest(unused: String) {
|
||||
val testPath = testPath()
|
||||
val testName = getTestName(false)
|
||||
innerPerfTest(testName) {
|
||||
myFixture.configureByFile(testPath)
|
||||
myFixture.configureByFile(fileName())
|
||||
|
||||
val document = myFixture.editor.document
|
||||
val beforeMarkerOffset = document.text.indexOf(BEFORE_MARKER)
|
||||
|
||||
+2
-2
@@ -54,10 +54,10 @@ abstract class AbstractPerformanceHighlightingTest : KotlinLightCodeInsightFixtu
|
||||
}
|
||||
}
|
||||
|
||||
protected fun doPerfTest(filePath: String) {
|
||||
protected fun doPerfTest(unused: String) {
|
||||
val testName = getTestName(false)
|
||||
innerPerfTest(testName) {
|
||||
myFixture.configureByFile(filePath)
|
||||
myFixture.configureByFile(fileName())
|
||||
|
||||
val project = myFixture.project
|
||||
commitAllDocuments()
|
||||
|
||||
+8
-7
@@ -26,12 +26,11 @@ import java.io.File
|
||||
|
||||
abstract class AbstractPerformanceImportTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
|
||||
override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory()
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
||||
protected abstract fun stats(): Stats
|
||||
|
||||
protected fun doPerfTest(testPath: String) {
|
||||
protected fun doPerfTest(unused: String) {
|
||||
val testName = getTestName(false)
|
||||
|
||||
CodeStyle.setTemporarySettings(project, CodeStyle.getSettings(project).clone())
|
||||
@@ -41,13 +40,13 @@ abstract class AbstractPerformanceImportTest : KotlinLightCodeInsightFixtureTest
|
||||
val fixture = myFixture
|
||||
val dependencySuffixes = listOf(".dependency.kt", ".dependency.java", ".dependency1.kt", ".dependency2.kt")
|
||||
for (suffix in dependencySuffixes) {
|
||||
val dependencyPath = testPath.replace(".kt", suffix)
|
||||
if (File(dependencyPath).exists()) {
|
||||
val dependencyPath = fileName().replace(".kt", suffix)
|
||||
if (File(testDataPath, dependencyPath).exists()) {
|
||||
fixture.configureByFile(dependencyPath)
|
||||
}
|
||||
}
|
||||
|
||||
fixture.configureByFile(testPath)
|
||||
fixture.configureByFile(fileName())
|
||||
|
||||
var file = fixture.file as KtFile
|
||||
|
||||
@@ -84,7 +83,7 @@ abstract class AbstractPerformanceImportTest : KotlinLightCodeInsightFixtureTest
|
||||
stats().perfTest<Unit, String>(
|
||||
testName = testName,
|
||||
setUp = {
|
||||
fixture.configureByFile(testPath)
|
||||
fixture.configureByFile(fileName())
|
||||
file = fixture.file as KtFile
|
||||
|
||||
fileText = file.text
|
||||
@@ -96,7 +95,9 @@ abstract class AbstractPerformanceImportTest : KotlinLightCodeInsightFixtureTest
|
||||
},
|
||||
tearDown = {
|
||||
val log = it.value
|
||||
KotlinTestUtils.assertEqualsToFile(File("$testPath.after"), fixture.file.text)
|
||||
val testPath = testPath()
|
||||
val afterFile = File("$testPath.after")
|
||||
KotlinTestUtils.assertEqualsToFile(afterFile, fixture.file.text)
|
||||
if (log != null) {
|
||||
val logFile = File("$testPath.log")
|
||||
if (log.isNotEmpty()) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract class AbstractPsiCheckerTest extends KotlinLightCodeInsightFixtu
|
||||
}
|
||||
|
||||
public void doTest(@NotNull String filePath) throws Exception {
|
||||
myFixture.configureByFile(filePath);
|
||||
myFixture.configureByFile(fileName());
|
||||
checkHighlighting(true, false, false);
|
||||
checkResolveToDescriptor();
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractPsiCheckerTest extends KotlinLightCodeInsightFixtu
|
||||
|
||||
public void doTestWithInfos(@NotNull String filePath) throws Exception {
|
||||
try {
|
||||
myFixture.configureByFile(filePath);
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
//noinspection unchecked
|
||||
myFixture.enableInspections(SpellCheckingInspection.class);
|
||||
|
||||
+11
-11
@@ -6,8 +6,6 @@
|
||||
package org.jetbrains.kotlin.idea.conversion.copy
|
||||
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import org.jetbrains.kotlin.idea.AbstractCopyPasteTest
|
||||
import org.jetbrains.kotlin.idea.editor.KotlinEditorOptions
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
@@ -37,27 +35,29 @@ abstract class AbstractJavaToKotlinCopyPasteConversionTest : AbstractJ2kCopyPast
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
fun doTest(path: String) {
|
||||
myFixture.testDataPath = BASE_PATH
|
||||
val testName = getTestName(false)
|
||||
myFixture.configureByFiles(testName + ".java")
|
||||
fun doTest(unused: String) {
|
||||
val path = testPath()
|
||||
val baseName = fileName().replace(".java", "")
|
||||
myFixture.configureByFiles("$baseName.java")
|
||||
|
||||
val fileText = myFixture.editor.document.text
|
||||
val noConversionExpected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// NO_CONVERSION_EXPECTED").isNotEmpty()
|
||||
|
||||
myFixture.performEditorAction(IdeActions.ACTION_COPY)
|
||||
|
||||
configureByDependencyIfExists(testName + ".dependency.kt")
|
||||
configureByDependencyIfExists(testName + ".dependency.java")
|
||||
configureByDependencyIfExists("$baseName.dependency.kt")
|
||||
configureByDependencyIfExists("$baseName.dependency.java")
|
||||
|
||||
configureTargetFile(testName + ".to.kt")
|
||||
configureTargetFile("$baseName.to.kt")
|
||||
|
||||
ConvertJavaCopyPasteProcessor.conversionPerformed = false
|
||||
|
||||
myFixture.performEditorAction(IdeActions.ACTION_PASTE)
|
||||
|
||||
assertEquals(noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed,
|
||||
if (noConversionExpected) "Conversion to Kotlin should not be suggested" else "No conversion to Kotlin suggested")
|
||||
assertEquals(
|
||||
noConversionExpected, !ConvertJavaCopyPasteProcessor.conversionPerformed,
|
||||
if (noConversionExpected) "Conversion to Kotlin should not be suggested" else "No conversion to Kotlin suggested"
|
||||
)
|
||||
|
||||
KotlinTestUtils.assertEqualsToFile(File(path.replace(".java", ".expected.kt")), myFixture.file.text)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user