Add tests for script configuration machinery, namely ScriptTemplateProvider EP
Test highlighting and navigation depending on provided script definition
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class Utils {
|
||||
public static void foo(String str) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
test.Utils.fo<caret>o("asd")
|
||||
// REF: (in test.Utils).foo(String)
|
||||
// FILE: test/Utils.java
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package custom.scriptDefinition
|
||||
|
||||
import org.jetbrains.kotlin.script.*
|
||||
import java.io.File
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.Future
|
||||
|
||||
class TestDependenciesResolver : ScriptDependenciesResolver {
|
||||
override fun resolve(
|
||||
script: ScriptContents,
|
||||
environment: Map<String, Any?>?,
|
||||
report: (ScriptDependenciesResolver.ReportSeverity, String, ScriptContents.Position?) -> Unit, previousDependencies: KotlinScriptExternalDependencies?
|
||||
): Future<KotlinScriptExternalDependencies?> {
|
||||
return CompletableFuture.completedFuture(
|
||||
object : KotlinScriptExternalDependencies {
|
||||
override val classpath: Iterable<File> = listOf(environment?.get("lib-classes") as File)
|
||||
override val sources: Iterable<File> = listOf(environment?.get("lib-source") as File)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ScriptTemplateDefinition(TestDependenciesResolver::class, scriptFilePattern = "script.kts")
|
||||
class Template
|
||||
Reference in New Issue
Block a user