<@U3A9GLEBY> and <@U0CHHN4F4> I have that covered,...
# scripting
a
@rpmoore and @ilya.chernikov I have that covered, have default imports on the configurable annotation based script definition. Could also make a script definition just for this with it built in. Or an annotation that does it as well for the auto-detect case. Currently it is this:
Copy code
fun makeConfigurableEngine(defaultImports: List<String> = emptyList()): ResettableRepl =
            ResettableRepl(scriptDefinition = ConfigurableAnnotationBasedScriptDefinition(
            "varargTemplateWithMavenResolving",
            ScriptTemplateWithArgs::class,
            ScriptArgsWithTypes(EMPTY_SCRIPT_ARGS, EMPTY_SCRIPT_ARGS_TYPES),
            defaultImports = defaultImports))

    @Test
    fun testConfigurableResolversEmpty() {
        makeConfigurableEngine().use { repl ->
            repl.compileAndEval("""val x = 10 + 100""")
            assertEquals(110, repl.compileAndEval("""x""").resultValue)
        }
    }

    @Test
    fun testConfigurableResolversFailsWithoutCorrectImport() {
        makeConfigurableEngine().use { repl ->
            try {
                repl.compileAndEval("""val now = Instant.now()""")
                fail("Expected compile error")
            } catch (ex: ReplCompilerException) {
                assertTrue("unresolved reference: Instant" in ex.message!!)
            }
        }
    }

    @Test
    fun testConfigurableResolversWithDefaultImports() {
        makeConfigurableEngine(defaultImports = listOf("java.time.*")).use { repl ->
            val now = Instant.now()
            repl.compileAndEval("""val now = Instant.now()""")
            val result = repl.compileAndEval("""now""").resultValue as Instant
            assertTrue(result >= now)
        }
    }