Skip to content

Commit 113a645

Browse files
committed
Allow using kotlin.test from tests in the core module from JavaFx
1 parent f85a6fb commit 113a645

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

kotlinx-coroutines-core/common/test/MainDispatcherTestBase.kt

+3-11
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ abstract class MainDispatcherTestBase: TestBase() {
2626
/** Tests the [toString] behavior of [Dispatchers.Main] and [MainCoroutineDispatcher.immediate] */
2727
@Test
2828
fun testMainDispatcherToString() {
29-
// TODO: workaround for not having module-info.java for the `test` source set
30-
if (Dispatchers.Main.toString() != "Dispatchers.Main") {
31-
throw AssertionError("Expected Dispatchers.Main, but had ${Dispatchers.Main}")
32-
}
33-
if (Dispatchers.Main.immediate.toString() != "Dispatchers.Main.immediate") {
34-
throw AssertionError("Expected Dispatchers.Main.immediate, but had ${Dispatchers.Main.immediate}")
35-
}
29+
assertEquals("Dispatchers.Main", Dispatchers.Main.toString())
30+
assertEquals("Dispatchers.Main.immediate", Dispatchers.Main.immediate.toString())
3631
}
3732

3833
/** Tests that the tasks scheduled earlier from [MainCoroutineDispatcher.immediate] will be executed earlier,
@@ -54,10 +49,7 @@ abstract class MainDispatcherTestBase: TestBase() {
5449
/** Tests that [Dispatchers.Main] and its [MainCoroutineDispatcher.immediate] are treated as different values. */
5550
@Test
5651
fun testHandlerDispatcherNotEqualToImmediate() {
57-
// TODO: workaround for not having module-info.java for the `test` source set
58-
if (Dispatchers.Main == Dispatchers.Main.immediate) {
59-
throw AssertionError("Expected Dispatchers.Main and Dispatchers.Main.immediate not to be equal")
60-
}
52+
assertNotEquals(Dispatchers.Main, Dispatchers.Main.immediate)
6153
}
6254

6355
/** Tests that after a delay, the execution gets back to the main thread. */

ui/kotlinx-coroutines-javafx/build.gradle.kts

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@
22
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
buildscript {
6-
dependencies {
7-
// this line can be removed when https://github.com/openjfx/javafx-gradle-plugin/pull/135 is released
8-
classpath("org.javamodularity:moduleplugin:1.8.12")
9-
}
10-
}
11-
125
plugins {
13-
id("org.openjfx.javafxplugin") version "0.0.13"
6+
id("org.openjfx.javafxplugin") version "0.0.14"
147
}
158

169
configurations {
@@ -34,6 +27,7 @@ tasks {
3427
test {
3528
extensions.configure(org.javamodularity.moduleplugin.extensions.TestModuleOptions::class) {
3629
addReads["kotlinx.coroutines.core"] = "junit"
30+
addReads["kotlinx.coroutines.core"] = "kotlin.test"
3731
addReads["kotlinx.coroutines.javafx"] = "kotlin.test"
3832
}
3933
jvmArgs = listOf(

0 commit comments

Comments
 (0)