Skip to content

Commit a3dfeb3

Browse files
committed
Adds another test for the reduced syntax format.
1 parent fd5cba7 commit a3dfeb3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/scala/PolicySpec.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ class PolicySpec extends FunSpec with BeforeAndAfterAll {
6868
Await.ready(future, Duration.Inf)
6969
assert(counter.get() === 2)
7070
}
71+
72+
it ("should retry futures passed by-name instead of caching results") {
73+
implicit val success = Success.always
74+
val counter = new AtomicInteger()
75+
val future = retry.Directly(1) {
76+
counter.getAndIncrement() match {
77+
case 1 => Future.successful("yay!")
78+
case _ => Future.failed(new RuntimeException("failed"))
79+
}
80+
}
81+
val result: String = Await.result(future, Duration.Inf)
82+
assert(counter.get() == 2)
83+
assert(result == "yay!")
84+
}
7185
}
7286

7387
describe("retry.Pause") {

0 commit comments

Comments
 (0)