Skip to content

Commit de9f90d

Browse files
demiurg906Space Team
authored andcommitted
[Test] Use JUnit5 instead of kotlin-test in jsr223-test
For some reason kotlin-test is not propagated to `:embeddableTest` test task.
1 parent 682c709 commit de9f90d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

libraries/scripting/jsr223-test/test/kotlin/script/experimental/jsr223/test/KotlinJsr223ScriptEngineIT.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion
1313
import org.jetbrains.kotlin.scripting.compiler.plugin.runAndCheckResults
1414
import org.jetbrains.kotlin.test.util.KtTestUtil
1515
import org.jetbrains.kotlin.utils.PathUtil
16+
import org.junit.jupiter.api.Assertions.assertEquals
17+
import org.junit.jupiter.api.Assertions.assertNotNull
18+
import org.junit.jupiter.api.Assertions.assertNull
19+
import org.junit.jupiter.api.Assertions.assertSame
20+
import org.junit.jupiter.api.Assertions.assertTrue
21+
import org.junit.jupiter.api.Test
22+
import org.junit.jupiter.api.fail
1623
import java.io.File
1724
import java.lang.management.ManagementFactory
1825
import java.nio.file.Files.createTempDirectory
1926
import java.nio.file.Files.createTempFile
2027
import javax.script.*
2128
import kotlin.script.experimental.jvmhost.jsr223.KotlinJsr223ScriptEngineImpl
2229
import kotlin.script.templates.standard.ScriptTemplateWithBindings
23-
import kotlin.test.*
2430

2531
// duplicating it here to avoid dependency on the implementation - it may interfere with tests
2632
private const val KOTLIN_JSR223_RESOLVE_FROM_CLASSLOADER_PROPERTY = "kotlin.jsr223.experimental.resolve.dependencies.from.context.classloader"
@@ -86,8 +92,7 @@ class KotlinJsr223ScriptEngineIT {
8692
assertEquals(5, res2)
8793
}
8894

89-
@Test
90-
@Ignore // Probably not possible to make it sensible on CI and with parallel run, so leaving it here for manual testing only
95+
// @Test // Probably not possible to make it sensible on CI and with parallel run, so leaving it here for manual testing only
9196
fun testMemory() {
9297
val memoryMXBean = ManagementFactory.getMemoryMXBean()!!
9398
var prevMem = memoryMXBean.getHeapMemoryUsage().getUsed()
@@ -189,7 +194,7 @@ obj
189194
""")
190195
assertNotNull(res0)
191196
val invocator = engine as? Invocable
192-
assertNotNull(invocator)
197+
requireNotNull(invocator)
193198
val res1 = invocator.invokeFunction("fn", 6)
194199
assertEquals(8, res1)
195200
assertThrows(NoSuchMethodException::class.java) {
@@ -387,7 +392,7 @@ obj
387392
val result = scriptEngine.eval(script)
388393

389394
assertTrue(result is Function0<*>)
390-
assertEquals(3, result.invoke())
395+
assertEquals(3, (result as Function0<*>).invoke())
391396
}
392397

393398
@Test

0 commit comments

Comments
 (0)