Misc: Extract AbstractConfigureKotlinInTempDirTest superclass (181/AS32)
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import org.junit.Assert
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
|
open class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
||||||
|
override fun getProjectDirOrFile(): Path {
|
||||||
|
val tempDir = FileUtil.generateRandomTemporaryPath()
|
||||||
|
FileUtil.createTempDirectory("temp", null)
|
||||||
|
myFilesToDelete.add(tempDir)
|
||||||
|
|
||||||
|
FileUtil.copyDir(File(projectRoot), tempDir)
|
||||||
|
|
||||||
|
val projectRoot = tempDir.path
|
||||||
|
|
||||||
|
val projectFilePath = projectRoot + "/projectFile.ipr"
|
||||||
|
if (!File(projectFilePath).exists()) {
|
||||||
|
val dotIdeaPath = projectRoot + "/.idea"
|
||||||
|
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
||||||
|
return File(projectRoot).toPath()
|
||||||
|
}
|
||||||
|
|
||||||
|
return File(projectFilePath).toPath()
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import org.junit.Assert
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
open class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun getIprFile(): File {
|
||||||
|
val tempDir = FileUtil.generateRandomTemporaryPath()
|
||||||
|
FileUtil.createTempDirectory("temp", null)
|
||||||
|
|
||||||
|
FileUtil.copyDir(File(projectRoot), tempDir)
|
||||||
|
|
||||||
|
val projectRoot = tempDir.path
|
||||||
|
|
||||||
|
val projectFilePath = projectRoot + "/projectFile.ipr"
|
||||||
|
if (!File(projectFilePath).exists()) {
|
||||||
|
val dotIdeaPath = projectRoot + "/.idea"
|
||||||
|
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
||||||
|
return File(projectRoot)
|
||||||
|
}
|
||||||
|
return File(projectFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-20
@@ -30,26 +30,7 @@ import java.io.File
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() {
|
||||||
override fun getProjectDirOrFile(): Path {
|
|
||||||
val tempDir = FileUtil.generateRandomTemporaryPath()
|
|
||||||
FileUtil.createTempDirectory("temp", null)
|
|
||||||
myFilesToDelete.add(tempDir)
|
|
||||||
|
|
||||||
FileUtil.copyDir(File(projectRoot), tempDir)
|
|
||||||
|
|
||||||
val projectRoot = tempDir.path
|
|
||||||
|
|
||||||
val projectFilePath = projectRoot + "/projectFile.ipr"
|
|
||||||
if (!File(projectFilePath).exists()) {
|
|
||||||
val dotIdeaPath = projectRoot + "/.idea"
|
|
||||||
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
|
||||||
return File(projectRoot).toPath()
|
|
||||||
}
|
|
||||||
|
|
||||||
return File(projectFilePath).toPath()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun testNoKotlincExistsNoSettingsRuntime10() {
|
fun testNoKotlincExistsNoSettingsRuntime10() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
|
|||||||
+1
-21
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.idea.configuration
|
|||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.application.impl.ApplicationImpl
|
import com.intellij.openapi.application.impl.ApplicationImpl
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
@@ -26,28 +25,9 @@ import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgu
|
|||||||
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() {
|
||||||
@Throws(IOException::class)
|
|
||||||
override fun getIprFile(): File {
|
|
||||||
val tempDir = FileUtil.generateRandomTemporaryPath()
|
|
||||||
FileUtil.createTempDirectory("temp", null)
|
|
||||||
|
|
||||||
FileUtil.copyDir(File(projectRoot), tempDir)
|
|
||||||
|
|
||||||
val projectRoot = tempDir.path
|
|
||||||
|
|
||||||
val projectFilePath = projectRoot + "/projectFile.ipr"
|
|
||||||
if (!File(projectFilePath).exists()) {
|
|
||||||
val dotIdeaPath = projectRoot + "/.idea"
|
|
||||||
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
|
||||||
return File(projectRoot)
|
|
||||||
}
|
|
||||||
return File(projectFilePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun testNoKotlincExistsNoSettingsRuntime10() {
|
fun testNoKotlincExistsNoSettingsRuntime10() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
|
|||||||
Reference in New Issue
Block a user