Skip to content

Commit 0456a75

Browse files
authored
ZIO 2.0.0-RC5 (#80)
1 parent dd4b60e commit 0456a75

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ addCommandAlias(
3737
";zioCacheNative/test:compile"
3838
)
3939

40-
val zioVersion = "2.0.0-RC4"
40+
val zioVersion = "2.0.0-RC5"
4141

4242
lazy val root = project
4343
.in(file("."))

zio-cache/shared/src/test/scala/zio/cache/CacheSpec.scala

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import zio._
44
import zio.test.Assertion._
55
import zio.test._
66

7-
object CacheSpec extends DefaultRunnableSpec {
7+
object CacheSpec extends ZIOSpecDefault {
88

99
def hash(x: Int): Int => UIO[Int] =
1010
y => ZIO.succeed((x ^ y).hashCode)
1111

12-
def spec: ZSpec[Environment, Failure] = suite("CacheSpec")(
12+
def spec: ZSpec[Environment, Any] = suite("CacheSpec")(
1313
test("cacheStats") {
1414
check(Gen.int) { salt =>
1515
for {
1616
cache <- Cache.make(100, Duration.Infinity, Lookup(hash(salt)))
17-
_ <- ZIO.foreachPar_((1 to 100).map(_ / 2))(cache.get)
17+
_ <- ZIO.foreachParDiscard((1 to 100).map(_ / 2))(cache.get)
1818
cacheStats <- cache.cacheStats
1919
hits = cacheStats.hits
2020
misses = cacheStats.misses
@@ -26,17 +26,17 @@ object CacheSpec extends DefaultRunnableSpec {
2626
check(Gen.int) { salt =>
2727
for {
2828
cache <- Cache.make(100, Duration.Infinity, Lookup(hash(salt)))
29-
_ <- ZIO.foreach_(1 to 100)(cache.get)
29+
_ <- ZIO.foreachDiscard(1 to 100)(cache.get)
3030
_ <- cache.invalidate(42)
3131
contains <- cache.contains(42)
3232
} yield assert(contains)(isFalse)
3333
}
3434
},
35-
testM("invalidateAll") {
36-
checkM(Gen.anyInt) { salt =>
35+
test("invalidateAll") {
36+
check(Gen.int) { salt =>
3737
for {
3838
cache <- Cache.make(100, Duration.Infinity, Lookup(hash(salt)))
39-
_ <- ZIO.foreach_(1 to 100)(cache.get)
39+
_ <- ZIO.foreachDiscard(1 to 100)(cache.get)
4040
_ <- cache.invalidateAll
4141
size <- cache.size
4242
} yield assertTrue(size == 0)
@@ -72,7 +72,7 @@ object CacheSpec extends DefaultRunnableSpec {
7272
}
7373
),
7474
suite("`refresh` method")(
75-
testM("should update the cache with a new value") {
75+
test("should update the cache with a new value") {
7676
def inc(n: Int) = n * 10
7777
def retrieve(multiplier: Ref[Int])(key: Int) =
7878
multiplier
@@ -90,7 +90,7 @@ object CacheSpec extends DefaultRunnableSpec {
9090
val2 <- cache.get(key)
9191
} yield assertTrue(val1 == inc(key)) && assertTrue(val2 == inc(val1))
9292
},
93-
testM("should update the cache with a new value even if the last `get` or `refresh` failed") {
93+
test("should update the cache with a new value even if the last `get` or `refresh` failed") {
9494

9595
val error = new RuntimeException("Must be a multiple of 3")
9696

@@ -122,13 +122,13 @@ object CacheSpec extends DefaultRunnableSpec {
122122
assert(val1)(isRight(equalTo(4))) &&
123123
assert(val2)(isRight(equalTo(7)))
124124
},
125-
testM("should get the value if the key doesn't exist in the cache") {
126-
checkM(Gen.anyInt) { salt =>
125+
test("should get the value if the key doesn't exist in the cache") {
126+
check(Gen.int) { salt =>
127127
val cap = 100
128128
for {
129129
cache <- Cache.make(cap, Duration.Infinity, Lookup(hash(salt)))
130130
count0 <- cache.size
131-
_ <- ZIO.foreach_(1 to cap)(cache.refresh)
131+
_ <- ZIO.foreachDiscard(1 to cap)(cache.refresh)
132132
count1 <- cache.size
133133
} yield assertTrue(count0 == 0) && assertTrue(count1 == cap)
134134
}
@@ -138,7 +138,7 @@ object CacheSpec extends DefaultRunnableSpec {
138138
check(Gen.int) { salt =>
139139
for {
140140
cache <- Cache.make(10, Duration.Infinity, Lookup(hash(salt)))
141-
_ <- ZIO.foreach_(1 to 100)(cache.get)
141+
_ <- ZIO.foreachDiscard(1 to 100)(cache.get)
142142
size <- cache.size
143143
} yield assertTrue(size == 10)
144144
}

0 commit comments

Comments
 (0)