
org.jetbrains.kotlinx.jupyter.test.repl.ReplWithReceiverTests.kt Maven / Gradle / Ivy
package org.jetbrains.kotlinx.jupyter.test.repl
import jupyter.kotlin.receivers.ConstReceiver
import org.jetbrains.kotlinx.jupyter.EvalRequestData
import org.jetbrains.kotlinx.jupyter.repl.creating.createRepl
import org.jetbrains.kotlinx.jupyter.test.classpath
import org.junit.jupiter.api.Test
import java.io.File
import kotlin.test.assertEquals
class ReplWithReceiverTests : AbstractReplTest() {
@Test
fun testReplWithReceiver() {
val value = 5
val cp = classpath + File(ConstReceiver::class.java.protectionDomain.codeSource.location.toURI().path)
val repl = createRepl(resolutionInfoProvider, cp, null, scriptReceivers = listOf(ConstReceiver(value)))
val res = repl.evalEx(EvalRequestData("value"))
assertEquals(value, res.rawValue)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy