Add test on repl with implicit receiver
This commit is contained in:
+22
-1
@@ -55,6 +55,25 @@ class ReplTest : TestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testImplicitReceiver() {
|
||||||
|
val receiver = TestReceiver()
|
||||||
|
chechEvaluateInRepl(
|
||||||
|
simpleScriptompilationConfiguration.with {
|
||||||
|
implicitReceivers(TestReceiver::class)
|
||||||
|
},
|
||||||
|
simpleScriptEvaluationConfiguration.with {
|
||||||
|
implicitReceivers(receiver)
|
||||||
|
},
|
||||||
|
sequenceOf(
|
||||||
|
"val x = 4",
|
||||||
|
"x + prop1",
|
||||||
|
"res1 * 3"
|
||||||
|
),
|
||||||
|
sequenceOf(null, 7, 21)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testEvalWithError() {
|
fun testEvalWithError() {
|
||||||
chechEvaluateInRepl(
|
chechEvaluateInRepl(
|
||||||
@@ -141,4 +160,6 @@ val simpleScriptompilationConfiguration = createJvmCompilationConfigurationFromT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val simpleScriptEvaluationConfiguration = ScriptEvaluationConfiguration()
|
val simpleScriptEvaluationConfiguration = ScriptEvaluationConfiguration()
|
||||||
|
|
||||||
|
class TestReceiver(val prop1: Int = 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user