@@ -128,16 +128,30 @@ module Immutable =
128128
129129module SideEffects =
130130 [<Theory; ClassData( typeof< TestSideEffectTaskSeq>) >]
131- let ``TaskSeq - takeWhile filters correctly`` variant =
132- Gen.getSeqWithSideEffect variant
133- |> TaskSeq.takeWhile condWithGuard
134- |> verifyDigitsAsString " ABCDE"
131+ let ``TaskSeq - takeWhile + A filters correctly`` variant = task {
132+ do !
133+ Gen.getSeqWithSideEffect variant
134+ |> TaskSeq.takeWhile condWithGuard
135+ |> verifyDigitsAsString " ABCDE"
136+
137+ do !
138+ Gen.getSeqWithSideEffect variant
139+ |> TaskSeq.takeWhileAsync ( fun x -> task { return condWithGuard x })
140+ |> verifyDigitsAsString " ABCDE"
141+ }
135142
136143 [<Theory; ClassData( typeof< TestSideEffectTaskSeq>) >]
137- let ``TaskSeq - takeWhileAsync filters correctly`` variant =
138- Gen.getSeqWithSideEffect variant
139- |> TaskSeq.takeWhileAsync ( fun x -> task { return condWithGuard x })
140- |> verifyDigitsAsString " ABCDE"
144+ let ``TaskSeq - takeWhileInclusive + A filters correctly`` variant = task {
145+ do !
146+ Gen.getSeqWithSideEffect variant
147+ |> TaskSeq.takeWhileInclusive condWithGuard
148+ |> verifyDigitsAsString " ABCDEF"
149+
150+ do !
151+ Gen.getSeqWithSideEffect variant
152+ |> TaskSeq.takeWhileInclusiveAsync ( fun x -> task { return condWithGuard x })
153+ |> verifyDigitsAsString " ABCDEF"
154+ }
141155
142156 [<Theory>]
143157 [<InlineData( false , false ) >]
@@ -184,6 +198,7 @@ module SideEffects =
184198 let expectedFirst = if inclusive then [| 42 ; 44 * 2 |] else [| 42 |]
185199 let expectedRepeat = if inclusive then [| 45 ; 47 * 2 |] else [| 45 |]
186200
201+ x |> should equal 41
187202 let! first = items |> functionToTest |> TaskSeq.toArrayAsync
188203 x |> should equal 44
189204 let! repeat = items |> functionToTest |> TaskSeq.toArrayAsync
@@ -205,6 +220,7 @@ module SideEffects =
205220 first |> should equal expected
206221
207222 // side effect, reiterating causes it to resume from where we left it (minus the failing item)
223+ // which means the original sequence has now changed due to the side effect
208224 let! repeat =
209225 TaskSeq.takeWhile ( fun x -> x < 5 ) ts
210226 |> TaskSeq.toArrayAsync
@@ -224,6 +240,7 @@ module SideEffects =
224240 first |> should equal expected
225241
226242 // side effect, reiterating causes it to resume from where we left it (minus the failing item)
243+ // which means the original sequence has now changed due to the side effect
227244 let! repeat =
228245 TaskSeq.takeWhileInclusiveAsync ( fun x -> task { return x < 5 }) ts
229246 |> TaskSeq.toArrayAsync
@@ -237,7 +254,7 @@ module Other =
237254 [<InlineData( false , true ) >]
238255 [<InlineData( true , false ) >]
239256 [<InlineData( true , true ) >]
240- let ``TaskSeq - takeWhileXXX exclude all items after predicate fails`` ( inclusive , isAsync ) =
257+ let ``TaskSeq - takeWhileXXX should exclude all items after predicate fails`` ( inclusive , isAsync ) =
241258 let functionToTest = With.getFunction inclusive isAsync
242259
243260 [ 1 ; 2 ; 2 ; 3 ; 3 ; 2 ; 1 ]
0 commit comments