192: Fix accessors to module & project in tests
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ class LiveTemplatesTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
myFixture.testDataPath = File(TEST_DATA_BASE_PATH).path + File.separator
|
myFixture.testDataPath = File(TEST_DATA_BASE_PATH).path + File.separator
|
||||||
TemplateManagerImpl.setTemplateTesting(myModule.project, testRootDisposable)
|
TemplateManagerImpl.setTemplateTesting(module.project, testRootDisposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testSout() {
|
fun testSout() {
|
||||||
|
|||||||
-2
@@ -60,8 +60,6 @@ import kotlin.reflect.full.findAnnotation
|
|||||||
abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFixtureTestCaseBase() {
|
abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFixtureTestCaseBase() {
|
||||||
private val exceptions = ArrayList<Throwable>()
|
private val exceptions = ArrayList<Throwable>()
|
||||||
|
|
||||||
protected val module: Module get() = myFixture.module
|
|
||||||
|
|
||||||
protected open val captureExceptions = true
|
protected open val captureExceptions = true
|
||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ abstract class AbstractNavigationTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
val fileText = FileUtil.loadFile(mainFile, true)
|
val fileText = FileUtil.loadFile(mainFile, true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
|
|
||||||
myFixture.testDataPath = "${KotlinTestUtils.getHomeDirectory()}/${mainFile.parent}"
|
myFixture.testDataPath = "${KotlinTestUtils.getHomeDirectory()}/${mainFile.parent}"
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ abstract class AbstractNavigationTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
NavigationTestUtils.assertGotoDataMatching(editor, getSourceAndTargetElements(editor, file))
|
NavigationTestUtils.assertGotoDataMatching(editor, getSourceAndTargetElements(editor, file))
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(myModule, fileText)
|
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class KotlinShortNamesCacheTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
fun testGetMethodsByNameWithFunctions() {
|
fun testGetMethodsByNameWithFunctions() {
|
||||||
myFixture.configureByFile("kotlinShortNamesCacheTestDataMethods.kt")
|
myFixture.configureByFile("kotlinShortNamesCacheTestDataMethods.kt")
|
||||||
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule)
|
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)
|
||||||
checkIsSingleMethodFound(scope, "KotlinShortNamesCacheTestDataMethodsKt.topLevelFunction", true)
|
checkIsSingleMethodFound(scope, "KotlinShortNamesCacheTestDataMethodsKt.topLevelFunction", true)
|
||||||
checkIsSingleMethodFound(scope, "B1.staticMethodOfObject", true)
|
checkIsSingleMethodFound(scope, "B1.staticMethodOfObject", true)
|
||||||
checkIsSingleMethodFound(scope, "B1.nonStaticMethodOfObject", false)
|
checkIsSingleMethodFound(scope, "B1.nonStaticMethodOfObject", false)
|
||||||
@@ -197,7 +197,7 @@ class KotlinShortNamesCacheTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
fun doTestGetMethodsByNameWithAccessors(file: String) {
|
fun doTestGetMethodsByNameWithAccessors(file: String) {
|
||||||
myFixture.configureByFile(file)
|
myFixture.configureByFile(file)
|
||||||
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule)
|
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)
|
||||||
checkIsVarAccessorsFound(scope, "topLevelVar", "KotlinShortNameCacheTestData.getTopLevelVar",
|
checkIsVarAccessorsFound(scope, "topLevelVar", "KotlinShortNameCacheTestData.getTopLevelVar",
|
||||||
"KotlinShortNameCacheTestData.setTopLevelVar", true)
|
"KotlinShortNameCacheTestData.setTopLevelVar", true)
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ class KotlinShortNamesCacheTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
fun testGetFieldsByName() {
|
fun testGetFieldsByName() {
|
||||||
myFixture.configureByFile("kotlinShortNamesCacheTestDataFields.kt")
|
myFixture.configureByFile("kotlinShortNamesCacheTestDataFields.kt")
|
||||||
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule)
|
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)
|
||||||
checkIsSingleFieldFound(scope, "KotlinShortNamesCacheTestDataFieldsKt.topLevelVar", true)
|
checkIsSingleFieldFound(scope, "KotlinShortNamesCacheTestDataFieldsKt.topLevelVar", true)
|
||||||
checkIsSingleFieldFound(scope, "B1.objectVar", true)
|
checkIsSingleFieldFound(scope, "B1.objectVar", true)
|
||||||
checkIsSingleFieldFound(scope, "C1.classVar", false)
|
checkIsSingleFieldFound(scope, "C1.classVar", false)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
} catch (exc: Exception) {
|
} catch (exc: Exception) {
|
||||||
throw RuntimeException(exc)
|
throw RuntimeException(exc)
|
||||||
} finally {
|
} finally {
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(myModule, fileText)
|
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
||||||
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = false
|
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -58,7 +58,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
var mainPsiFile: KtFile? = null
|
var mainPsiFile: KtFile? = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
|
|
||||||
val mainFile = File(path)
|
val mainFile = File(path)
|
||||||
val mainFileName = mainFile.name
|
val mainFileName = mainFile.name
|
||||||
@@ -112,7 +112,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mainPsiFile?.forcedTargetPlatform = null
|
mainPsiFile?.forcedTargetPlatform = null
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(myModule, fileText)
|
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|||||||
|
|
||||||
abstract class AbstractGenerateTestSupportMethodActionTest : AbstractCodeInsightActionTest() {
|
abstract class AbstractGenerateTestSupportMethodActionTest : AbstractCodeInsightActionTest() {
|
||||||
private fun setUpTestSourceRoot() {
|
private fun setUpTestSourceRoot() {
|
||||||
val module = myModule
|
|
||||||
val model = ModuleRootManager.getInstance(module).modifiableModel
|
val model = ModuleRootManager.getInstance(module).modifiableModel
|
||||||
val entry = model.contentEntries.single()
|
val entry = model.contentEntries.single()
|
||||||
val sourceFolderFile = entry.sourceFolderFiles.single()
|
val sourceFolderFile = entry.sourceFolderFiles.single()
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ abstract class AbstractInternalCompiledClassesTest : KotlinLightCodeInsightFixtu
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun doTest(fileKind: String, acceptFile: VirtualFile.() -> Boolean, performTest: VirtualFile.() -> Unit) {
|
protected fun doTest(fileKind: String, acceptFile: VirtualFile.() -> Boolean, performTest: VirtualFile.() -> Unit) {
|
||||||
val root = findTestLibraryRoot(myModule!!)!!
|
val root = findTestLibraryRoot(module!!)!!
|
||||||
var foundAtLeastOneFile = false
|
var foundAtLeastOneFile = false
|
||||||
root.checkRecursively {
|
root.checkRecursively {
|
||||||
if (acceptFile()) {
|
if (acceptFile()) {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.utils.sure
|
|||||||
|
|
||||||
abstract class AbstractNavigateFromLibrarySourcesTest : LightCodeInsightFixtureTestCase() {
|
abstract class AbstractNavigateFromLibrarySourcesTest : LightCodeInsightFixtureTestCase() {
|
||||||
protected fun navigationElementForReferenceInLibrarySource(filePath: String, referenceText: String): PsiElement {
|
protected fun navigationElementForReferenceInLibrarySource(filePath: String, referenceText: String): PsiElement {
|
||||||
val libraryOrderEntry = ModuleRootManager.getInstance(myModule!!).orderEntries.first { it is LibraryOrderEntry }
|
val libraryOrderEntry = ModuleRootManager.getInstance(module!!).orderEntries.first { it is LibraryOrderEntry }
|
||||||
val libSourcesRoot = libraryOrderEntry.getUrls(OrderRootType.SOURCES)[0]
|
val libSourcesRoot = libraryOrderEntry.getUrls(OrderRootType.SOURCES)[0]
|
||||||
val libUrl = "$libSourcesRoot/$filePath"
|
val libUrl = "$libSourcesRoot/$filePath"
|
||||||
val vf = VirtualFileManager.getInstance().refreshAndFindFileByUrl(libUrl)
|
val vf = VirtualFileManager.getInstance().refreshAndFindFileByUrl(libUrl)
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ class ClsStubBuilderForWrongAbiVersionTest : AbstractClsStubBuilderTest() {
|
|||||||
fun testClass() = testStubsForFileWithWrongAbiVersion("ClassWithWrongAbiVersion")
|
fun testClass() = testStubsForFileWithWrongAbiVersion("ClassWithWrongAbiVersion")
|
||||||
|
|
||||||
private fun testStubsForFileWithWrongAbiVersion(className: String) {
|
private fun testStubsForFileWithWrongAbiVersion(className: String) {
|
||||||
val root = findTestLibraryRoot(myModule!!)!!
|
val root = findTestLibraryRoot(module!!)!!
|
||||||
val result = root.findClassFileByName(className)
|
val result = root.findClassFileByName(className)
|
||||||
testClsStubsForFile(result, null)
|
testClsStubsForFile(result, null)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ private const val CHECK_PACKAGE_DIRECTIVE = "CHECK_PACKAGE"
|
|||||||
|
|
||||||
abstract class AbstractDecompiledTextFromJsMetadataTest(baseDirectory: String) :
|
abstract class AbstractDecompiledTextFromJsMetadataTest(baseDirectory: String) :
|
||||||
AbstractDecompiledTextBaseTest(baseDirectory, true, withRuntime = true) {
|
AbstractDecompiledTextBaseTest(baseDirectory, true, withRuntime = true) {
|
||||||
override fun getFileToDecompile(): VirtualFile = getKjsmFile(TEST_PACKAGE, myModule!!)
|
override fun getFileToDecompile(): VirtualFile = getKjsmFile(TEST_PACKAGE, module!!)
|
||||||
|
|
||||||
override fun checkPsiFile(psiFile: PsiFile) =
|
override fun checkPsiFile(psiFile: PsiFile) =
|
||||||
assertTrue(psiFile is KtDecompiledFile, "Expecting decompiled kotlin javascript file, was: " + psiFile::class.java)
|
assertTrue(psiFile is KtDecompiledFile, "Expecting decompiled kotlin javascript file, was: " + psiFile::class.java)
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ import kotlin.test.assertTrue
|
|||||||
|
|
||||||
abstract class AbstractDecompiledTextTest(baseDirectory: String, allowKotlinPackage: Boolean)
|
abstract class AbstractDecompiledTextTest(baseDirectory: String, allowKotlinPackage: Boolean)
|
||||||
: AbstractDecompiledTextBaseTest(baseDirectory, allowKotlinPackage = allowKotlinPackage) {
|
: AbstractDecompiledTextBaseTest(baseDirectory, allowKotlinPackage = allowKotlinPackage) {
|
||||||
override fun getFileToDecompile(): VirtualFile = getClassFile(TEST_PACKAGE, getTestName(false), myModule!!)
|
override fun getFileToDecompile(): VirtualFile = getClassFile(TEST_PACKAGE, getTestName(false), module!!)
|
||||||
|
|
||||||
override fun checkStubConsistency(file: VirtualFile, decompiledText: String) {
|
override fun checkStubConsistency(file: VirtualFile, decompiledText: String) {
|
||||||
val fileWithDecompiledText = KtPsiFactory(project).createFile(decompiledText)
|
val fileWithDecompiledText = KtPsiFactory(project).createFile(decompiledText)
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ class DecompiledTextForWrongAbiVersionTest : AbstractInternalCompiledClassesTest
|
|||||||
fun testPackagePartWithWrongAbiVersion() = doTest("Wrong_packageKt")
|
fun testPackagePartWithWrongAbiVersion() = doTest("Wrong_packageKt")
|
||||||
|
|
||||||
fun doTest(name: String) {
|
fun doTest(name: String) {
|
||||||
val root = findTestLibraryRoot(myModule!!)!!
|
val root = findTestLibraryRoot(module!!)!!
|
||||||
checkFileWithWrongAbiVersion(root.findClassFileByName(name))
|
checkFileWithWrongAbiVersion(root.findClassFileByName(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ abstract class LazyElementTypeTestBase<T>(private val lazyElementClass: Class<T>
|
|||||||
val expressionBefore = PsiTreeUtil.findChildOfType(file, lazyElementClass)
|
val expressionBefore = PsiTreeUtil.findChildOfType(file, lazyElementClass)
|
||||||
|
|
||||||
performTypingAction(myFixture.editor, char)
|
performTypingAction(myFixture.editor, char)
|
||||||
PsiDocumentManager.getInstance(LightPlatformTestCase.getProject()).commitDocument(myFixture.getDocument(file))
|
PsiDocumentManager.getInstance(project).commitDocument(myFixture.getDocument(file))
|
||||||
|
|
||||||
val expressionAfter = PsiTreeUtil.findChildOfType(file, lazyElementClass)
|
val expressionAfter = PsiTreeUtil.findChildOfType(file, lazyElementClass)
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val fileText = FileUtil.loadFile(mainFile, true)
|
val fileText = FileUtil.loadFile(mainFile, true)
|
||||||
val configured = configureCompilerOptions(fileText, project, module)
|
val configured = configureCompilerOptions(fileText, project, module)
|
||||||
|
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TestCase.assertTrue("\"<caret>\" is missing in file \"$mainFile\"", fileText.contains("<caret>"))
|
TestCase.assertTrue("\"<caret>\" is missing in file \"$mainFile\"", fileText.contains("<caret>"))
|
||||||
@@ -113,7 +113,7 @@ abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(file as KtFile)
|
DirectiveBasedActionUtils.checkForUnexpectedErrors(file as KtFile)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(myModule, fileText)
|
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
||||||
if (configured) {
|
if (configured) {
|
||||||
rollbackCompilerOptions(project, module)
|
rollbackCompilerOptions(project, module)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
|||||||
|
|
||||||
fixtureClasses = InTextDirectivesUtils.findListWithPrefixes(fileText, "// FIXTURE_CLASS: ")
|
fixtureClasses = InTextDirectivesUtils.findListWithPrefixes(fileText, "// FIXTURE_CLASS: ")
|
||||||
for (fixtureClass in fixtureClasses) {
|
for (fixtureClass in fixtureClasses) {
|
||||||
TestFixtureExtension.loadFixture(fixtureClass, LightPlatformTestCase.getModule())
|
TestFixtureExtension.loadFixture(fixtureClass, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
|
|
||||||
fun testEnableCoroutinesFacet() {
|
fun testEnableCoroutinesFacet() {
|
||||||
configureRuntime("mockRuntime11")
|
configureRuntime("mockRuntime11")
|
||||||
val facet = configureKotlinFacet(myModule) {
|
val facet = configureKotlinFacet(module) {
|
||||||
settings.languageLevel = LanguageVersion.KOTLIN_1_1
|
settings.languageLevel = LanguageVersion.KOTLIN_1_1
|
||||||
}
|
}
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_1)
|
resetProjectSettings(LanguageVersion.KOTLIN_1_1)
|
||||||
@@ -102,15 +102,15 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
fun testIncreaseLangLevelFacet() {
|
fun testIncreaseLangLevelFacet() {
|
||||||
configureRuntime("mockRuntime11")
|
configureRuntime("mockRuntime11")
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
||||||
configureKotlinFacet(myModule) {
|
configureKotlinFacet(module) {
|
||||||
settings.languageLevel = LanguageVersion.KOTLIN_1_0
|
settings.languageLevel = LanguageVersion.KOTLIN_1_0
|
||||||
settings.apiLevel = LanguageVersion.KOTLIN_1_0
|
settings.apiLevel = LanguageVersion.KOTLIN_1_0
|
||||||
}
|
}
|
||||||
myFixture.configureByText("foo.kt", "val x get() = 1")
|
myFixture.configureByText("foo.kt", "val x get() = 1")
|
||||||
|
|
||||||
assertEquals(LanguageVersion.KOTLIN_1_0, myModule.languageVersionSettings.languageVersion)
|
assertEquals(LanguageVersion.KOTLIN_1_0, module.languageVersionSettings.languageVersion)
|
||||||
myFixture.launchAction(myFixture.findSingleIntention("Set module language version to 1.1"))
|
myFixture.launchAction(myFixture.findSingleIntention("Set module language version to 1.1"))
|
||||||
assertEquals(LanguageVersion.KOTLIN_1_1, myModule.languageVersionSettings.languageVersion)
|
assertEquals(LanguageVersion.KOTLIN_1_1, module.languageVersionSettings.languageVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testIncreaseLangAndApiLevel() {
|
fun testIncreaseLangAndApiLevel() {
|
||||||
@@ -140,15 +140,15 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
fun testIncreaseLangLevelFacet_10() {
|
fun testIncreaseLangLevelFacet_10() {
|
||||||
configureRuntime("mockRuntime106")
|
configureRuntime("mockRuntime106")
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
||||||
configureKotlinFacet(myModule) {
|
configureKotlinFacet(module) {
|
||||||
settings.languageLevel = LanguageVersion.KOTLIN_1_0
|
settings.languageLevel = LanguageVersion.KOTLIN_1_0
|
||||||
settings.apiLevel = LanguageVersion.KOTLIN_1_0
|
settings.apiLevel = LanguageVersion.KOTLIN_1_0
|
||||||
}
|
}
|
||||||
myFixture.configureByText("foo.kt", "val x = <caret>\"s\"::length")
|
myFixture.configureByText("foo.kt", "val x = <caret>\"s\"::length")
|
||||||
|
|
||||||
assertEquals(LanguageVersion.KOTLIN_1_0, myModule.languageVersionSettings.languageVersion)
|
assertEquals(LanguageVersion.KOTLIN_1_0, module.languageVersionSettings.languageVersion)
|
||||||
myFixture.launchAction(myFixture.findSingleIntention("Set module language version to 1.1"))
|
myFixture.launchAction(myFixture.findSingleIntention("Set module language version to 1.1"))
|
||||||
assertEquals(LanguageVersion.KOTLIN_1_1, myModule.languageVersionSettings.languageVersion)
|
assertEquals(LanguageVersion.KOTLIN_1_1, module.languageVersionSettings.languageVersion)
|
||||||
|
|
||||||
assertEquals(bundledRuntimeVersion(), getRuntimeLibraryVersion(myFixture.module))
|
assertEquals(bundledRuntimeVersion(), getRuntimeLibraryVersion(myFixture.module))
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
fun y01() = Foo::prop.gett<caret>er
|
fun y01() = Foo::prop.gett<caret>er
|
||||||
""")
|
""")
|
||||||
myFixture.launchAction(myFixture.findSingleIntention("Add kotlin-reflect.jar to the classpath"))
|
myFixture.launchAction(myFixture.findSingleIntention("Add kotlin-reflect.jar to the classpath"))
|
||||||
val kotlinRuntime = KotlinJavaModuleConfigurator.instance.getKotlinLibrary(myModule)!!
|
val kotlinRuntime = KotlinJavaModuleConfigurator.instance.getKotlinLibrary(module)!!
|
||||||
val classes = kotlinRuntime.getFiles(OrderRootType.CLASSES).map { it.name }
|
val classes = kotlinRuntime.getFiles(OrderRootType.CLASSES).map { it.name }
|
||||||
assertContainsElements(classes, "kotlin-reflect.jar")
|
assertContainsElements(classes, "kotlin-reflect.jar")
|
||||||
val sources = kotlinRuntime.getFiles(OrderRootType.SOURCES)
|
val sources = kotlinRuntime.getFiles(OrderRootType.SOURCES)
|
||||||
@@ -200,10 +200,10 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.InlineClasses)
|
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.InlineClasses)
|
||||||
|
|
||||||
override fun tearDown() {
|
override fun tearDown() {
|
||||||
FacetManager.getInstance(myModule).getFacetByType(KotlinFacetType.TYPE_ID)?.let {
|
FacetManager.getInstance(module).getFacetByType(KotlinFacetType.TYPE_ID)?.let {
|
||||||
FacetUtil.deleteFacet(it)
|
FacetUtil.deleteFacet(it)
|
||||||
}
|
}
|
||||||
ConfigLibraryUtil.removeLibrary(myModule, "KotlinJavaRuntime")
|
ConfigLibraryUtil.removeLibrary(module, "KotlinJavaRuntime")
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -341,11 +341,11 @@ abstract class AbstractExtractionTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
val fileText = FileUtil.loadFile(File(path), true)
|
val fileText = FileUtil.loadFile(File(path), true)
|
||||||
|
|
||||||
val configured = configureCompilerOptions(fileText, project, module)
|
val configured = configureCompilerOptions(fileText, project, module)
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myModule, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
|
|
||||||
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null
|
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null
|
||||||
if (addKotlinRuntime) {
|
if (addKotlinRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(module, PluginTestCaseBase.mockJdk())
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -353,7 +353,7 @@ abstract class AbstractExtractionTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (addKotlinRuntime) {
|
if (addKotlinRuntime) {
|
||||||
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(module, PluginTestCaseBase.mockJdk())
|
||||||
}
|
}
|
||||||
if (configured) {
|
if (configured) {
|
||||||
rollbackCompilerOptions(project, module)
|
rollbackCompilerOptions(project, module)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ abstract class AbstractRenameTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sourceRoot in ModuleRootManager.getInstance(myModule).sourceRoots) {
|
for (sourceRoot in ModuleRootManager.getInstance(module).sourceRoots) {
|
||||||
VfsUtilCore.visitChildrenRecursively(sourceRoot, visitor)
|
VfsUtilCore.visitChildrenRecursively(sourceRoot, visitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ abstract class AbstractIdeReplCompletionTest : KotlinFixtureCompletionBaseTestCa
|
|||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
consoleRunner = KotlinConsoleKeeper.getInstance(project).run(myModule)!!
|
consoleRunner = KotlinConsoleKeeper.getInstance(project).run(module)!!
|
||||||
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
|
|||||||
|
|
||||||
MockLibraryUtil.compileKotlin(baseDir.path, outputDir)
|
MockLibraryUtil.compileKotlin(baseDir.path, outputDir)
|
||||||
|
|
||||||
PsiTestUtil.setCompilerOutputPath(myModule, outputDir.path, false)
|
PsiTestUtil.setCompilerOutputPath(module, outputDir.path, false)
|
||||||
|
|
||||||
val mainFileName = "$dirName/${getTestName(true)}.kts"
|
val mainFileName = "$dirName/${getTestName(true)}.kts"
|
||||||
doCompilingTest(mainFileName)
|
doCompilingTest(mainFileName)
|
||||||
doReplTest(mainFileName)
|
doReplTest(mainFileName)
|
||||||
|
|
||||||
ModuleRootModificationUtil.updateModel(myModule) { model ->
|
ModuleRootModificationUtil.updateModel(module) { model ->
|
||||||
model.getModuleExtension(CompilerModuleExtension::class.java).inheritCompilerOutputPath(true)
|
model.getModuleExtension(CompilerModuleExtension::class.java).inheritCompilerOutputPath(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.util.*
|
|||||||
|
|
||||||
abstract class AbstractJavaToKotlinConverterMultiFileTest : AbstractJavaToKotlinConverterTest() {
|
abstract class AbstractJavaToKotlinConverterMultiFileTest : AbstractJavaToKotlinConverterTest() {
|
||||||
fun doTest(dirPath: String) {
|
fun doTest(dirPath: String) {
|
||||||
val project = LightPlatformTestCase.getProject()!!
|
|
||||||
val psiManager = PsiManager.getInstance(project)
|
val psiManager = PsiManager.getInstance(project)
|
||||||
|
|
||||||
val filesToConvert = File(dirPath).listFiles { _, name -> name.endsWith(".java") }
|
val filesToConvert = File(dirPath).listFiles { _, name -> name.endsWith(".java") }
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ abstract class AbstractJavaToKotlinConverterSingleFileTest : AbstractJavaToKotli
|
|||||||
val testHeaderPattern = Pattern.compile("//(element|expression|statement|method|class|file|comp)\n")
|
val testHeaderPattern = Pattern.compile("//(element|expression|statement|method|class|file|comp)\n")
|
||||||
|
|
||||||
open fun doTest(javaPath: String) {
|
open fun doTest(javaPath: String) {
|
||||||
val project = LightPlatformTestCase.getProject()!!
|
|
||||||
val javaFile = File(javaPath)
|
val javaFile = File(javaPath)
|
||||||
val fileContents = FileUtil.loadFile(javaFile, true)
|
val fileContents = FileUtil.loadFile(javaFile, true)
|
||||||
val matcher = testHeaderPattern.matcher(fileContents)
|
val matcher = testHeaderPattern.matcher(fileContents)
|
||||||
|
|||||||
Reference in New Issue
Block a user