File tree Expand file tree Collapse file tree
tests/FSharpx.Async.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -439,10 +439,10 @@ module AsyncSeq =
439439 let rec skipWhileAsync p ( input : AsyncSeq < 'T >) : AsyncSeq < _ > = async {
440440 let! v = input
441441 match v with
442- | Cons( h, t) ->
442+ | Cons( h, t) ->
443443 let! res = p h
444444 if res then return ! skipWhileAsync p t
445- else return ! t
445+ else return v
446446 | Nil -> return Nil }
447447
448448 /// Returns elements from an asynchronous sequence while the specified
Original file line number Diff line number Diff line change 1+ module AsyncSeqTests
2+
3+ open NUnit.Framework
4+ open FSharpx.Control
5+
6+ [<Test>]
7+ let ``skipping should return all elements after the first non - match`` () =
8+ let expected = [ 3 ; 4 ]
9+ let result =
10+ [ 1 ; 2 ; 3 ; 4 ]
11+ |> AsyncSeq.ofSeq
12+ |> AsyncSeq.skipWhile ( fun i -> i <= 2 )
13+ |> AsyncSeq.toBlockingSeq
14+ |> Seq.toList
15+ Assert.AreEqual( expected, result)
Original file line number Diff line number Diff line change 5858 <Import Project =" $(SolutionDir)\.nuget\NuGet.targets" Condition =" Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
5959 <ItemGroup >
6060 <Compile Include =" AsyncTest.fs" />
61+ <Compile Include =" AsyncSeqTests.fs" />
6162 <None Include =" paket.references" />
6263 </ItemGroup >
6364 <ItemGroup >
You can’t perform that action at this time.
0 commit comments