@@ -25,13 +25,6 @@ module With =
2525 | true , false -> TaskSeq.takeWhileInclusive
2626 | true , true -> fun pred -> TaskSeq.takeWhileInclusiveAsync ( pred >> Task.fromResult)
2727
28- /// Turns a sequence of numbers into a string, starting with A for '1'
29- let verifyAsString expected =
30- TaskSeq.map char
31- >> TaskSeq.map ((+) '@' )
32- >> TaskSeq.toArrayAsync
33- >> Task.map ( String >> should equal expected)
34-
3528 /// This is the base condition as one would expect in actual code
3629 let inline cond x = x <> 6
3730
@@ -82,65 +75,65 @@ module Immutable =
8275 do !
8376 Gen.getSeqImmutable variant
8477 |> TaskSeq.takeWhile condWithGuard
85- |> verifyAsString " ABCDE"
78+ |> verifyDigitsAsString " ABCDE"
8679
8780 do !
8881 Gen.getSeqImmutable variant
8982 |> TaskSeq.takeWhileAsync ( fun x -> task { return condWithGuard x })
90- |> verifyAsString " ABCDE"
83+ |> verifyDigitsAsString " ABCDE"
9184 }
9285
9386 [<Theory; ClassData( typeof< TestImmTaskSeq>) >]
9487 let ``TaskSeq - takeWhile + A does not pick first item when false`` variant = task {
9588 do !
9689 Gen.getSeqImmutable variant
9790 |> TaskSeq.takeWhile ((=) 0 )
98- |> verifyAsString " "
91+ |> verifyDigitsAsString " "
9992
10093 do !
10194 Gen.getSeqImmutable variant
10295 |> TaskSeq.takeWhileAsync ((=) 0 >> Task.fromResult)
103- |> verifyAsString " "
96+ |> verifyDigitsAsString " "
10497 }
10598
10699 [<Theory; ClassData( typeof< TestImmTaskSeq>) >]
107100 let ``TaskSeq - takeWhileInclusive + A filters correctly`` variant = task {
108101 do !
109102 Gen.getSeqImmutable variant
110103 |> TaskSeq.takeWhileInclusive condWithGuard
111- |> verifyAsString " ABCDEF"
104+ |> verifyDigitsAsString " ABCDEF"
112105
113106 do !
114107 Gen.getSeqImmutable variant
115108 |> TaskSeq.takeWhileInclusiveAsync ( fun x -> task { return condWithGuard x })
116- |> verifyAsString " ABCDEF"
109+ |> verifyDigitsAsString " ABCDEF"
117110 }
118111
119112 [<Theory; ClassData( typeof< TestImmTaskSeq>) >]
120113 let ``TaskSeq - takeWhileInclusive + A always pick at least the first item`` variant = task {
121114 do !
122115 Gen.getSeqImmutable variant
123116 |> TaskSeq.takeWhileInclusive ((=) 0 )
124- |> verifyAsString " A"
117+ |> verifyDigitsAsString " A"
125118
126119 do !
127120 Gen.getSeqImmutable variant
128121 |> TaskSeq.takeWhileInclusiveAsync ((=) 0 >> Task.fromResult)
129- |> verifyAsString " A"
122+ |> verifyDigitsAsString " A"
130123 }
131124
132125module SideEffects =
133126 [<Theory; ClassData( typeof< TestSideEffectTaskSeq>) >]
134127 let ``TaskSeq - takeWhile filters correctly`` variant =
135128 Gen.getSeqWithSideEffect variant
136129 |> TaskSeq.takeWhile condWithGuard
137- |> verifyAsString " ABCDE"
130+ |> verifyDigitsAsString " ABCDE"
138131
139132 [<Theory; ClassData( typeof< TestSideEffectTaskSeq>) >]
140133 let ``TaskSeq - takeWhileAsync filters correctly`` variant =
141134 Gen.getSeqWithSideEffect variant
142135 |> TaskSeq.takeWhileAsync ( fun x -> task { return condWithGuard x })
143- |> verifyAsString " ABCDE"
136+ |> verifyDigitsAsString " ABCDE"
144137
145138 [<Theory>]
146139 [<InlineData( false , false ) >]
@@ -246,7 +239,7 @@ module Other =
246239 [ 1 ; 2 ; 2 ; 3 ; 3 ; 2 ; 1 ]
247240 |> TaskSeq.ofSeq
248241 |> functionToTest ( fun x -> x <= 2 )
249- |> verifyAsString ( if inclusive then " ABBC" else " ABB" )
242+ |> verifyDigitsAsString ( if inclusive then " ABBC" else " ABB" )
250243
251244 [<Theory>]
252245 [<InlineData( false , false ) >]
@@ -262,4 +255,4 @@ module Other =
262255 }
263256 |> TaskSeq.ofSeq
264257 |> functionToTest ( fun x -> x <= 2 )
265- |> verifyAsString ( if inclusive then " ABBC" else " ABB" )
258+ |> verifyDigitsAsString ( if inclusive then " ABBC" else " ABB" )
0 commit comments