@@ -43,7 +43,6 @@ import org.jetbrains.kotlinx.jupyter.test.renderedValue
43
43
import org.jetbrains.kotlinx.jupyter.test.withTempDirectories
44
44
import org.jetbrains.kotlinx.jupyter.util.DelegatingClassLoader
45
45
import org.jetbrains.kotlinx.jupyter.withPath
46
- import org.junit.jupiter.api.Assumptions.assumeTrue
47
46
import org.junit.jupiter.api.Disabled
48
47
import org.junit.jupiter.api.Test
49
48
import org.junit.jupiter.api.condition.DisabledOnOs
@@ -1080,8 +1079,6 @@ class ReplTests : AbstractSingleReplTest() {
1080
1079
)
1081
1080
1082
1081
// Doesn't work in K2, see KT-80019
1083
- assumeTrue(repl.compilerMode == K1 )
1084
-
1085
1082
val res =
1086
1083
eval(
1087
1084
"""
@@ -1090,23 +1087,39 @@ class ReplTests : AbstractSingleReplTest() {
1090
1087
""" .trimIndent(),
1091
1088
)
1092
1089
1093
- evalSuccess(" great()" ).renderedValue shouldBe " Great result!"
1094
-
1095
- withTempDirectories(" customPackages" ) {
1096
- val scriptsDir = newTempDir()
1097
- val sourcesDir = newTempDir()
1090
+ eval(" great()" ).let { invocationResult ->
1091
+ when (repl.compilerMode) {
1092
+ K1 -> invocationResult.renderedValue shouldBe " Great result!"
1093
+ K2 -> invocationResult.shouldBeInstanceOf<EvalResultEx .Error >()
1094
+ }
1095
+ }
1098
1096
1099
- val classNames =
1100
- CompiledScriptsSerializer ().deserializeAndSave(
1101
- res.metadata.compiledData,
1102
- scriptsDir,
1103
- sourcesDir,
1104
- )
1097
+ when (repl.compilerMode) {
1098
+ K1 -> {
1099
+ withTempDirectories(" customPackages" ) {
1100
+ val scriptsDir = newTempDir()
1101
+ val sourcesDir = newTempDir()
1102
+
1103
+ val classNames =
1104
+ CompiledScriptsSerializer ().deserializeAndSave(
1105
+ res.metadata.compiledData,
1106
+ scriptsDir,
1107
+ sourcesDir,
1108
+ )
1105
1109
1106
- scriptsDir.resolve(" com/xxx/pack/Line_1_jupyter.class" ).shouldExist()
1107
- sourcesDir.shouldContainFile(" Line_1.kts" )
1110
+ scriptsDir.resolve(" com/xxx/pack/Line_1_jupyter.class" ).shouldExist()
1111
+ sourcesDir.shouldContainFile(" Line_1.kts" )
1108
1112
1109
- classNames shouldBe listOf (" com.xxx.pack.Line_1_jupyter" )
1113
+ classNames shouldBe listOf (" com.xxx.pack.Line_1_jupyter" )
1114
+ }
1115
+ }
1116
+ K2 -> {
1117
+ res.shouldBeInstanceOf<EvalResultEx .Error >()
1118
+ with (res.metadata.compiledData) {
1119
+ scripts.shouldBeEmpty()
1120
+ sources.shouldBeEmpty()
1121
+ }
1122
+ }
1110
1123
}
1111
1124
}
1112
1125
}
0 commit comments