Skip to content

Commit 8d54856

Browse files
m-koopsTimvdLippe
authored andcommitted
Apply the test interfaces SynchronousFunctions and SuspendFunctions in CoroutinesTest
1 parent bf8d829 commit 8d54856

File tree

2 files changed

+166
-152
lines changed

2 files changed

+166
-152
lines changed

tests/src/test/kotlin/test/Classes.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package test
22

3+
import kotlinx.coroutines.Dispatchers
4+
import kotlinx.coroutines.delay
5+
import kotlinx.coroutines.withContext
6+
37
/*
48
* The MIT License
59
*
@@ -35,6 +39,15 @@ open class Open {
3539
}
3640
}
3741

42+
suspend fun intResult(i: Int): Int =
43+
withContext(Dispatchers.Default) { i }
44+
45+
suspend fun delayedIntResult(): Int =
46+
withContext(Dispatchers.Default) {
47+
delay(100)
48+
42
49+
}
50+
3851
open fun stringResult() = "Default"
3952

4053
fun throwsNPE(): Any = throw NullPointerException("Test")
@@ -71,7 +84,7 @@ interface SynchronousFunctions {
7184
fun closedVararg(vararg c: Closed)
7285
fun throwableClass(t: ThrowableClass)
7386
fun nullableString(s: String?)
74-
87+
fun intResult(): Int
7588
fun stringResult(): String
7689
fun stringResult(s: String): String
7790
fun nullableStringResult(): String?
@@ -91,6 +104,10 @@ interface SuspendFunctions {
91104
suspend fun closed(c: Closed)
92105
suspend fun closedBooleanResult(c: Closed): Boolean
93106
suspend fun classClosedBooleanResult(c: Class<Closed>): Boolean
107+
suspend fun intResult(): Int
108+
suspend fun intResult(i: Int): Int
109+
suspend fun stringResult(): String
110+
suspend fun stringResult(s: String): String
94111
}
95112

96113
@JvmInline

0 commit comments

Comments
 (0)