Use compiler arguments for Java against Kotlin highlighting tests
This is needed for the next commit to check jvm-default options #KT-41130 In Progress
This commit is contained in:
committed by
TeamCityServer
parent
111e54c8c1
commit
641f08d561
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// LANGUAGE_LEVEL 1.8
|
// LANGUAGE_LEVEL 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// KOTLINC_EXTRA_OPTS -jvm-target, 1.8, -Xjvm-default=enable
|
// COMPILER_ARGUMENTS: -jvm-target, 1.8, -Xjvm-default=enable
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// LANGUAGE_LEVEL 1.8
|
// LANGUAGE_LEVEL 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// KOTLINC_EXTRA_OPTS -jvm-target, 1.8
|
// COMPILER_ARGUMENTS: -jvm-target, 1.8
|
||||||
+5
-2
@@ -9,6 +9,7 @@ import com.intellij.openapi.roots.ModuleRootModificationUtil
|
|||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.openapi.util.io.FileUtilRt
|
import com.intellij.openapi.util.io.FileUtilRt
|
||||||
import org.jetbrains.kotlin.idea.test.AstAccessControl
|
import org.jetbrains.kotlin.idea.test.AstAccessControl
|
||||||
|
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -23,12 +24,14 @@ abstract class AbstractJavaAgainstKotlinBinariesCheckerTest : AbstractJavaAgains
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val languageLevelOption = InTextDirectivesUtils.findListWithPrefixes(configFileText ?: "", "// KOTLINC_EXTRA_OPTS")
|
val compilerArguments = InTextDirectivesUtils.findListWithPrefixes(
|
||||||
|
configFileText ?: "", CompilerTestDirectives.COMPILER_ARGUMENTS_DIRECTIVE
|
||||||
|
)
|
||||||
|
|
||||||
val libraryJar = MockLibraryUtilExt.compileJvmLibraryToJar(
|
val libraryJar = MockLibraryUtilExt.compileJvmLibraryToJar(
|
||||||
PluginTestCaseBase.getTestDataPathBase() + "/kotlinAndJavaChecker/javaAgainstKotlin/" + getTestName(false) + ".kt",
|
PluginTestCaseBase.getTestDataPathBase() + "/kotlinAndJavaChecker/javaAgainstKotlin/" + getTestName(false) + ".kt",
|
||||||
"libFor$testName",
|
"libFor$testName",
|
||||||
extraOptions = languageLevelOption
|
extraOptions = compilerArguments
|
||||||
)
|
)
|
||||||
val jarUrl = "jar://" + FileUtilRt.toSystemIndependentName(libraryJar.absolutePath) + "!/"
|
val jarUrl = "jar://" + FileUtilRt.toSystemIndependentName(libraryJar.absolutePath) + "!/"
|
||||||
ModuleRootModificationUtil.addModuleLibrary(module, jarUrl)
|
ModuleRootModificationUtil.addModuleLibrary(module, jarUrl)
|
||||||
|
|||||||
@@ -6,10 +6,22 @@
|
|||||||
package org.jetbrains.kotlin.checkers
|
package org.jetbrains.kotlin.checkers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.idea.perf.forceUsingOldLightClassesForTest
|
import org.jetbrains.kotlin.idea.perf.forceUsingOldLightClassesForTest
|
||||||
|
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
|
||||||
|
|
||||||
abstract class AbstractJavaAgainstKotlinSourceCheckerTest : AbstractJavaAgainstKotlinCheckerTest() {
|
abstract class AbstractJavaAgainstKotlinSourceCheckerTest : AbstractJavaAgainstKotlinCheckerTest() {
|
||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
doTest(true, true, path.replace(".kt", ".java"), path)
|
fun doTest() {
|
||||||
|
doTest(true, true, path.replace(".kt", ".java"), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
val configFile = configFileText
|
||||||
|
if (configFile != null) {
|
||||||
|
withCustomCompilerOptions(configFile, project, module) {
|
||||||
|
doTest()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
doTest()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user