@@ -53,17 +53,6 @@ type SmokeTestsForCompilation() =
5353 t.Wait()
5454 if t.Result <> 1 then failwith " failed"
5555
56- [<Fact>]
57- member _.mergesrc () =
58- task {
59- let! x = Task.FromResult( 1 )
60- and! y = Task.FromResult( 2 )
61- return x + y
62- }
63- |> fun t ->
64- t.Wait()
65- if t.Result <> 3 then failwith " failed"
66-
6756 [<Fact>]
6857 member _.tbind () =
6958 task {
@@ -194,6 +183,98 @@ type SmokeTestsForCompilation() =
194183 t.Wait()
195184 if t.Result <> 5 then failwith " failed"
196185
186+ [<Fact>]
187+ member _.merge2tasks () =
188+ task {
189+ let! x = Task.FromResult( 1 )
190+ and! y = Task.FromResult( 2 )
191+ return x + y
192+ }
193+ |> fun t ->
194+ t.Wait()
195+ if t.Result <> 3 then failwith " failed"
196+
197+ [<Fact>]
198+ member _.merge3tasks () =
199+ task {
200+ let! x = Task.FromResult( 1 )
201+ and! y = Task.FromResult( 2 )
202+ and! z = Task.FromResult( 3 )
203+ return x + y + z
204+ }
205+ |> fun t ->
206+ t.Wait()
207+ if t.Result <> 6 then failwith " failed"
208+
209+ [<Fact>]
210+ member _.mergeYieldAndTask () =
211+ task {
212+ let! _ = Task.Yield()
213+ and! y = Task.FromResult( 1 )
214+ return y
215+ }
216+ |> fun t ->
217+ t.Wait()
218+ if t.Result <> 1 then failwith " failed"
219+
220+ [<Fact>]
221+ member _.mergeTaskAndYield () =
222+ task {
223+ let! x = Task.FromResult( 1 )
224+ and! _ = Task.Yield()
225+ return x
226+ }
227+ |> fun t ->
228+ t.Wait()
229+ if t.Result <> 1 then failwith " failed"
230+
231+ [<Fact>]
232+ member _.merge2valueTasks () =
233+ task {
234+ let! x = ValueTask< int>( Task.FromResult( 1 ))
235+ and! y = ValueTask< int>( Task.FromResult( 2 ))
236+ return x + y
237+ }
238+ |> fun t ->
239+ t.Wait()
240+ if t.Result <> 3 then failwith " failed"
241+
242+ [<Fact>]
243+ member _.merge2valueTasksAndYield () =
244+ task {
245+ let! x = ValueTask< int>( Task.FromResult( 1 ))
246+ and! y = ValueTask< int>( Task.FromResult( 2 ))
247+ and! _ = Task.Yield()
248+ return x + y
249+ }
250+ |> fun t ->
251+ t.Wait()
252+ if t.Result <> 3 then failwith " failed"
253+
254+ [<Fact>]
255+ member _.mergeYieldAnd2tasks () =
256+ task {
257+ let! _ = Task.Yield()
258+ and! x = Task.FromResult( 1 )
259+ and! y = Task.FromResult( 2 )
260+ return x + y
261+ }
262+ |> fun t ->
263+ t.Wait()
264+ if t.Result <> 3 then failwith " failed"
265+
266+ [<Fact>]
267+ member _.merge2tasksAndValueTask () =
268+ task {
269+ let! x = Task.FromResult( 1 )
270+ and! y = Task.FromResult( 2 )
271+ and! z = ValueTask< int>( Task.FromResult( 3 ))
272+ return x + y + z
273+ }
274+ |> fun t ->
275+ t.Wait()
276+ if t.Result <> 6 then failwith " failed"
277+
197278exception TestException of string
198279
199280[<AutoOpen>]
0 commit comments