Add integration parity coverage and normalize test suite to task CE in FSharp.Control.R3#12
Add integration parity coverage and normalize test suite to task CE in FSharp.Control.R3#12Copilot wants to merge 18 commits into
Conversation
| let expectedSource = IntegrationParityTests.CreateSourceObservable () | ||
| let expectedFiltered = R3.ObservableExtensions.Where (expectedSource, fun x -> x % 2 = 0) | ||
| let expectedSelected = R3.ObservableExtensions.Select (expectedFiltered, fun x -> x * 10) | ||
| let expectedSkipped = R3.ObservableExtensions.Skip (expectedSelected, 1) | ||
| let expectedPipeline = R3.ObservableExtensions.Take (expectedSkipped, 1) |
There was a problem hiding this comment.
@copilot why not write original the same as F#?
| let expectedSource = IntegrationParityTests.CreateSourceObservable () | |
| let expectedFiltered = R3.ObservableExtensions.Where (expectedSource, fun x -> x % 2 = 0) | |
| let expectedSelected = R3.ObservableExtensions.Select (expectedFiltered, fun x -> x * 10) | |
| let expectedSkipped = R3.ObservableExtensions.Skip (expectedSelected, 1) | |
| let expectedPipeline = R3.ObservableExtensions.Take (expectedSkipped, 1) | |
| let expectedPipeline = | |
| IntegrationParityTests.CreateSourceObservable () | |
| |> _.Where(fun x -> x % 2 = 0) | |
| |> _.Select(fun x -> x * 10) | |
| |> _.Skip(1) | |
| |> _.Take(1) |
There was a problem hiding this comment.
Updated in 890893c. I changed the expected (direct R3) pipeline to fluent instance-style calls (source.Where/Select/Skip/Take) to keep it closer to idiomatic F# while still compiling reliably in this test context.
7e8d1fd to
0b2729a
Compare
| member _.``mapAsync should transform each value`` () = | ||
| let options = ProcessingOptions.Default | ||
| let source = TestHelpers.createObservable [| 1; 2; 3 |] | ||
| let actual = | ||
| source | ||
| |> Observable.mapAsync options (fun (_ : CancellationToken) x -> Task.FromResult (x + 1)) | ||
| |> TestHelpers.toArrayTask | ||
| |> TestHelpers.waitTask | ||
| CollectionAssert.AreEqual ([| 2; 3; 4 |], actual, "Task mapAsync must transform each source value.") |
| let! actual = | ||
| source | ||
| |> Observable.aggregate 0 (fun acc x -> acc + x) | ||
| |> Async.StartAsTask |
There was a problem hiding this comment.
@copilot
поставь в тесты <PackageReference Include="FSharp.Control.FusionTasks" Version="2.6.0" /> тогда не нужно будет писать |> Async.StartAsTask и поубирай эти вызовы
There was a problem hiding this comment.
Сделал в e824222: добавил FSharp.Control.FusionTasks в тестовый проект и убрал вызовы Async.StartAsTask из AsyncObservable тестов, переведя их на прямой let!/do! в task CE.
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/b095f03a-938a-4a06-95c5-e5801a65c7cd Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/b095f03a-938a-4a06-95c5-e5801a65c7cd Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/78d0c1b6-ce13-4e66-afab-ff7ae29025dc Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/1a9a39d4-61e8-489f-bff8-c1cf1814e0d4 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/1a9a39d4-61e8-489f-bff8-c1cf1814e0d4 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/d5e79ca1-4a19-4233-ae7a-390b0f5416b2 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/f5275f04-80ce-4f7f-b590-6d5daa0a054d Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/08eea792-5d36-4dec-90f8-e09312be0832 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/b75c1330-ae04-4568-91e8-4f490579252c Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/a6751a07-082f-4b6d-a346-d2b4f5d5f694 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/a6751a07-082f-4b6d-a346-d2b4f5d5f694 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/244a22d1-52fa-4b08-b7b2-729a28a43b65 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/732d168a-55cb-4c6c-be57-7f8ffe91a8dd Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Control.R3/sessions/408d36f0-589c-4395-8c1e-75d8acdbe389 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
068757d to
4935a5b
Compare
There was a problem hiding this comment.
Pull request overview
This PR restructures the test suite for FSharp.Control.R3 to provide category-based coverage across Observable, AsyncObservable, and TaskObservable, while adding targeted validation for ProcessingOptions/ChunkConfiguration.
Changes:
- Added shared
TestHelpersand introduced new category-based test files underObservable/,AsyncObservable/, andTaskObservable/. - Added new
ProcessingOptionsTeststo validateChunkConfigurationhelpers. - Updated the test project file layout and added a new package reference/version entry.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/FSharp.Control.R3.Tests/TestHelpers.fs | Adds shared helpers for creating observables and collecting results for assertions. |
| tests/FSharp.Control.R3.Tests/TaskObservable/TransformationCategoryTests.fs | Adds Task-based transformation tests (mapAsync, iter, iterAsync). |
| tests/FSharp.Control.R3.Tests/TaskObservable/SingleElementCategoryTests.fs | Adds Task-based single-element test (firstAsync). |
| tests/FSharp.Control.R3.Tests/TaskObservable/AllSelectionCategoryTests.fs | Adds Task-based selection tests (all, existsAsync). |
| tests/FSharp.Control.R3.Tests/TaskObservable/AggregationCategoryTests.fs | Adds Task-based aggregation tests (aggregate, length). |
| tests/FSharp.Control.R3.Tests/ProcessingOptionsTests.fs | Adds tests for ChunkConfiguration helpers and default time provider behavior. |
| tests/FSharp.Control.R3.Tests/ObservableTests.fs | Removes the prior monolithic Observable test file. |
| tests/FSharp.Control.R3.Tests/Observable/TransformationCategoryTests.fs | Adds category-based transformation tests (map, bind, mapi). |
| tests/FSharp.Control.R3.Tests/Observable/SingleElementCategoryTests.fs | Adds category-based single-element tests (singleton, empty). |
| tests/FSharp.Control.R3.Tests/Observable/ConversionCategoryTests.fs | Adds category-based conversion tests (asObservable, cast, ofType). |
| tests/FSharp.Control.R3.Tests/Observable/AllSelectionCategoryTests.fs | Adds category-based selection tests (where, filter, choose, distinct, chunkBy*, skip, take). |
| tests/FSharp.Control.R3.Tests/Observable/AggregationCategoryTests.fs | Adds category-based aggregation tests (concat, merge, catch). |
| tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj | Switches to wildcard compile includes, adds new folders/files, and adds a FusionTasks reference. |
| tests/FSharp.Control.R3.Tests/BuilderTests.fs | Removes the prior builder/rxquery test file. |
| tests/FSharp.Control.R3.Tests/AsyncObservable/TransformationCategoryTests.fs | Adds async-observable transformation tests and parity checks against direct R3 APIs. |
| tests/FSharp.Control.R3.Tests/AsyncObservable/SingleElementCategoryTests.fs | Adds async-observable single-element test (firstAsync). |
| tests/FSharp.Control.R3.Tests/AsyncObservable/ConversionCategoryTests.fs | Adds async-observable conversion tests (toArray, toList). |
| tests/FSharp.Control.R3.Tests/AsyncObservable/AllSelectionCategoryTests.fs | Adds async-observable selection tests (all, existsAsync). |
| tests/FSharp.Control.R3.Tests/AsyncObservable/AggregationCategoryTests.fs | Adds async-observable aggregation tests (aggregate, length). |
| Directory.Packages.props | Adds centrally-managed version entry for FSharp.Control.FusionTasks. |
Comments suppressed due to low confidence (1)
tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj:21
FSharp.Control.FusionTaskswas added to the test project, but the updated tests appear to use the built-intask {}CE (from FSharp.Core) and don’t reference FusionTasks APIs. If it’s not needed, removing this dependency will reduce restore/build surface area.
<PackageReference Include="altcover" />
<PackageReference Include="FSharp.Control.FusionTasks" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="Unquote" />
| <Compile Include="TestHelpers.fs" /> | ||
| <Compile Include="Observable/*.fs" /> | ||
| <Compile Include="AsyncObservable/*.fs" /> | ||
| <Compile Include="TaskObservable/*.fs" /> | ||
| <Compile Include="ProcessingOptionsTests.fs" /> |
| <Compile Include="TestHelpers.fs" /> | ||
| <Compile Include="Observable/*.fs" /> | ||
| <Compile Include="AsyncObservable/*.fs" /> | ||
| <Compile Include="TaskObservable/*.fs" /> | ||
| <Compile Include="ProcessingOptionsTests.fs" /> |
| <PackageVersion Include="Fake.DotNet.Paket" Version="6.1.4" /> | ||
| <PackageVersion Include="Fake.IO.FileSystem" Version="6.1.4" /> | ||
| <PackageVersion Include="Fake.Tools.Git" Version="6.1.4" /> | ||
| <PackageVersion Include="FSharp.Control.FusionTasks" Version="2.6.0" /> |
| open global.FSharp.Control | ||
| open Microsoft.VisualStudio.TestTools.UnitTesting | ||
| open global.R3 |
| open global.FSharp.Control | ||
| open Microsoft.VisualStudio.TestTools.UnitTesting | ||
| open global.R3 |
| open global.FSharp.Control | ||
| open Microsoft.VisualStudio.TestTools.UnitTesting | ||
| open global.R3 |
| open global.FSharp.Control | ||
| open Microsoft.VisualStudio.TestTools.UnitTesting | ||
| open global.R3 |
Uh oh!
There was an error while loading. Please reload this page.