aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-01 15:55:55 -0700
committerAllan Wang <me@allanwang.ca>2019-05-01 15:55:55 -0700
commit1554fb375786eeaf615717af15a27523b835051f (patch)
treede335acb1c034fae0bb81fea01c323bab03126b5 /app
parent5398c336ef8821d286a60fda593376eed99381a2 (diff)
downloadfrost-1554fb375786eeaf615717af15a27523b835051f.tar.gz
frost-1554fb375786eeaf615717af15a27523b835051f.tar.bz2
frost-1554fb375786eeaf615717af15a27523b835051f.zip
Restrict coroutine test
Diffstat (limited to 'app')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt
index e93f507c..5cde7323 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt
@@ -246,6 +246,8 @@ class CoroutineTest {
}
}
+ class TestException(msg: String) : RuntimeException(msg)
+
@Test
fun exceptionChecks() {
val mainTag = "main-test"
@@ -257,7 +259,7 @@ class CoroutineTest {
val job = SupervisorJob()
val flyweight = Flyweight<Int, Int>(GlobalScope, 200L) {
- throw java.lang.RuntimeException("Flyweight exception")
+ throw TestException("Flyweight exception")
}
suspend fun crash(): Boolean = withContext(Dispatchers.IO) {
@@ -266,7 +268,7 @@ class CoroutineTest {
flyweight.fetch(0).await()
}
true
- } catch (e: java.lang.Exception) {
+ } catch (e: TestException) {
false
}
}
@@ -282,10 +284,6 @@ class CoroutineTest {
println("B")
channel.offer(1)
}
-// launch {
-// delay(2000)
-// job.cancel()
-// }
}
}
}