b3a84ba081
In case of exception from dependencies resolver we do not threat the configurations as up-to-date, so the reloading process will be started during test despite updateScriptDependenciesSynchronously called at startup. This will lead to the warning from checkHighlighting because if script reports are different we rehighlight the script. Note that test won't fail.
23 lines
805 B
Kotlin
Vendored
23 lines
805 B
Kotlin
Vendored
package custom.scriptDefinition
|
|
|
|
import java.io.File
|
|
import kotlin.script.dependencies.*
|
|
import kotlin.script.experimental.dependencies.*
|
|
import kotlin.script.templates.ScriptTemplateDefinition
|
|
import kotlin.script.experimental.location.*
|
|
|
|
class TestDependenciesResolver : DependenciesResolver {
|
|
override fun resolve(
|
|
scriptContents: ScriptContents,
|
|
environment: Environment
|
|
): DependenciesResolver.ResolveResult {
|
|
throw ex
|
|
}
|
|
|
|
// this is needed for equality of script reports to avoid highlighting restart during test
|
|
private val ex = IllegalStateException("Exception from resolver")
|
|
}
|
|
|
|
@ScriptExpectedLocations([ScriptExpectedLocation.Everywhere])
|
|
@ScriptTemplateDefinition(TestDependenciesResolver::class, scriptFilePattern = "script.kts")
|
|
open class Template |