<https://kotlinlang.slack.com/archives/C0NBD4UF8/p...
# multiplatform
s
is using coroutines not an option?
k
It is, but I wouldn’t want my normal synchronous code to be tainted by coroutines solely so I can test it. Someone in ASG mentiond using something like
Copy code
withTimeout(...) {
  runInterruptable { myTestCode() }
}
but
runInterruptable
does not exist outside of the JVM
The psuedocode of what I’m doing is this:
Copy code
// Return an adjusted range that encompasses [value].
private fun IntRange.adjustBounds(value: Int): IntRange {
  var adjustedRange = this
  while (value !in adjustedRange) {
    adjustedRange = adjustedRange.decrement()
  }
  return adjustedRange
}
The types we’re working on isn’t an IntRange, but a custom range type, so doing something like coercing it with the stdlib isn’t an option. I don’t know of a better way to do this, I could elaborate on what precisely we’re doing but I’m not sure it’s important.