File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/FSharp.Control.TaskSeq.Test Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,19 @@ let ``CE taskSeq: use 'let!' with Async - mutables`` () =
9999
100100 taskSeq {
101101 do ! async { value <- value + 1 }
102+ do value |> should equal 1
102103 let! x = async { return value + 1 }
104+ do x |> should equal 2
103105 do ! Async.Sleep 50
104106 do ! async { value <- value + 1 }
107+ do value |> should equal 2
105108 let! ret = async { return value + 1 }
106- yield x + ret // eq 6
109+ do value |> should equal 2
110+ do ret |> should equal 3
111+ yield x + ret // eq 5
107112 }
108113 |> TaskSeq.exactlyOne
109- |> Task.map ( fun _ -> value |> should equal 6 )
114+ |> Task.map ( should equal 5 )
110115
111116[<Fact>]
112117let ``CE taskSeq : use 'let ! ' with all kinds of overloads at once`` () =
@@ -132,16 +137,16 @@ let ``CE taskSeq: use 'let!' with all kinds of overloads at once`` () =
132137
133138 let! c = ValueTask<_>( 4 ) // valuetask that completes immediately
134139 let! _ = Task.Factory.StartNew( fun () -> value <- value + 1 ) // non-generic Task with side effect
135- let! d = Task.fromResult ( 4 ) // normal Task that completes immediately
140+ let! d = Task.fromResult 99 // normal Task that completes immediately
136141 let! _ = Async.Sleep 0 // unit Async
137142
138143 let! e = async {
139144 do ! Async.Sleep 40
140- do value <- value + 1
145+ do value <- value + 1 // eq 4 now
141146 return value
142147 }
143148
144149 yield ! [ a; b; c; d; e ]
145150 }
146151 |> TaskSeq.toListAsync
147- |> Task.map ( fun x -> should equal [ 1 ; 2 ; 4 ; 4 ; 3 ])
152+ |> Task.map ( should equal [ 1 ; 2 ; 4 ; 99 ; 4 ])
You can’t perform that action at this time.
0 commit comments