Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,26 @@
let a = s |> AsyncSeq.toListSynchronously
Assert.True(([1;2;3;4] = a))

[<Test>]
let ``asyncSeq yield! list works``() =
let items = [1; 2; 3]
let s = asyncSeq {
yield! items
}
let a = s |> AsyncSeq.toListSynchronously
Assert.True(([1;2;3] = a))

[<Test>]
let ``asyncSeq yield! list combines with other yields``() =
let items = [2; 3]
let s = asyncSeq {
yield 1
yield! items
yield 4
}
let a = s |> AsyncSeq.toListSynchronously
Assert.True(([1;2;3;4] = a))

[<Test>]
let ``AsyncSeq.concatSeq works``() =
let ls = [ [1;2] ; [3;4] ]
Expand Down Expand Up @@ -1850,7 +1870,7 @@
let actual =
ls
|> AsyncSeq.ofSeq
|> AsyncSeq.groupBy p

Check warning on line 1873 in tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs

View workflow job for this annotation

GitHub Actions / build

The result of groupBy must be consumed with a parallel combinator such as AsyncSeq.mapAsyncParallel. Sequential consumption will deadlock because sub-sequence completion depends on other sub-sequences being consumed concurrently.
|> AsyncSeq.mapAsyncParallel (snd >> AsyncSeq.toListAsync)
Assert.AreEqual(expected, actual)

Expand All @@ -1859,7 +1879,7 @@
let expected = asyncSeq { raise (exn("test")) }
let actual =
asyncSeq { raise (exn("test")) }
|> AsyncSeq.groupBy (fun i -> i % 3)

Check warning on line 1882 in tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs

View workflow job for this annotation

GitHub Actions / build

The result of groupBy must be consumed with a parallel combinator such as AsyncSeq.mapAsyncParallel. Sequential consumption will deadlock because sub-sequence completion depends on other sub-sequences being consumed concurrently.
|> AsyncSeq.mapAsyncParallel (snd >> AsyncSeq.toListAsync)
Assert.AreEqual(expected, actual)

Expand Down
Loading