Skip to content

Commit

Permalink
Restores tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Jan 22, 2024
1 parent b77ff08 commit 32dd30c
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class StructuredConcurrency {
}

fun launchTest(id: Long, testName: String, f: () -> Unit) {
println("********************************************************************************************");
println("\nStarting test ($id): \"$testName\" at ${LocalDateTime.now()}")
f()
println("The whole test ($id) took ${measureTimeMillis { f() }} milliseconds to complete!")
println("\nTest ($id) \"$testName finished at ${LocalDateTime.now()}")
println("********************************************************************************************");
}
Expand Down Expand Up @@ -74,11 +75,15 @@ class CancellationStructuredConcurrency {
coroutineScope {

launch {
logCoroutinesWithADelayOf(1,1000)
logCoroutinesWithADelayOf(1, 1000)
}

launch {
logCoroutinesWithADelayOf(2,1000)
launch {
delay(500)
throw RuntimeException("Nothing runs now!")
}
logCoroutinesWithADelayOf(2, 1000)
}
println("This coroutine scope is launched here! ${this.coroutineContext}")
}
Expand All @@ -94,11 +99,11 @@ class CancellationStructuredConcurrency {
runCatching {
coroutineScope {
launch {
logCoroutinesWithADelayOf(1,1000)
logCoroutinesWithADelayOf(1, 1000)
}

launch {
logCoroutinesWithADelayOf(2,1000)
logCoroutinesWithADelayOf(2, 1000)
}
launch {
delay(500)
Expand Down

0 comments on commit 32dd30c

Please sign in to comment.