Skip to content

Commit

Permalink
Verify attempt returns Left in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Sep 8, 2024
1 parent f00b9cd commit 40cb12a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/shared/src/test/scala/cats/effect/ResourceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,9 @@ class ResourceSpec extends BaseSpec with ScalaCheck with Discipline {
.flatMap { ref =>
val resource = Resource.make(ref.update(_ + 1))(_ => ref.update(_ + 1))
val error = Resource.raiseError[IO, Unit, Throwable](new Exception)
(resource *> error).attempt.use { _ => ref.get.map { _ must be_==(2) } }
(resource *> error).attempt.use { r =>
IO(r must beLeft) *> ref.get.map { _ must be_==(2) }
}
}
.void must completeAs(())
}
Expand Down

0 comments on commit 40cb12a

Please sign in to comment.