Skip to content

Commit

Permalink
Move left-right recovery test to JVM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mijicd committed Apr 20, 2020
1 parent 4442d27 commit 19f1162
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core-tests/jvm/src/test/scala/zio/stm/ZSTMAlternativeSpec.scala
@@ -0,0 +1,20 @@
package zio
package stm

import zio.test.Assertion._
import zio.test._

object ZSTMAlternativeSpec extends ZIOBaseSpec {
def spec =
suite("ZSTM.alternative") {
testM("retries left after right retries") {
for {
ref <- TRef.makeCommit(0)
left = ref.get.flatMap(v => STM.check(v > 500).as("left"))
right = STM.retry
updater = ref.update(_ + 10).commit.forever
res <- (left <|> right).commit.race(updater)
} yield assert(res)(equalTo("left"))
}
}
}

0 comments on commit 19f1162

Please sign in to comment.