Skip to content

[Repo Assist] test: expand TaskSeq.fold tests with call-count, ordering, and edge case coverage#348

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-fold-tests-20260316-10feb1bd15349016
Draft

[Repo Assist] test: expand TaskSeq.fold tests with call-count, ordering, and edge case coverage#348
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-fold-tests-20260316-10feb1bd15349016

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

TaskSeq.Fold.Tests.fs previously had only 95 lines of test coverage across three sparse modules. This PR expands it to ~270 lines by adding a new Functionality module and extending the EmptySeq module with tests for scenarios that were previously absent.

New tests added

EmptySeq module (2 new tests):

  • fold does not call folder function when empty — verifies the folder is never invoked when the source sequence is empty (the initial state is returned immediately)
  • foldAsync does not call folder function when empty — same for the async variant

Functionality module (12 new tests):

  • Folder is called exactly N times for an N-element sequence (sync and async)
  • Single-element sequence calls folder once
  • Two-element sequence calls folder twice
  • Left-associativity: string concatenation confirms elements are applied left-to-right, i.e., fold f s [a;b;c] = f (f (f s a) b) c
  • Null initial state for reference-type accumulators works correctly
  • fold and foldAsync return the same result for pure functions
  • List accumulation preserving insertion order
  • fold and foldAsync summing over all TestImmTaskSeq variants

Changes

File Change
TaskSeq.Fold.Tests.fs +175 lines: new Functionality module, extended EmptySeq
release-notes.txt Updated under 1.0.0

Test Status

✅ Build: dotnet build src/FSharp.Control.TaskSeq.sln -c Releasesucceeded, 0 warnings, 0 errors
✅ Format: dotnet fantomas src/FSharp.Control.TaskSeq.Test/TaskSeq.Fold.Tests.fsapplied, then verified clean
✅ Tests (fold only): dotnet test ... --filter "FullyQualifiedName~TaskSeq.Tests.Fold"90 passed, 0 failed

Generated by Repo Assist

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

…ase coverage

Adds a new Functionality module and extends existing tests in
TaskSeq.Fold.Tests.fs. The file grows from 95 to ~270 lines,
exercising scenarios previously absent:

- Verify folder is NOT called when the source is empty
- Verify folder is called exactly N times for N-element sequences
- Single-element and two-element minimal cases
- Left-associativity / application order (non-commutative string concat)
- Null initial state for reference-type accumulators
- fold and foldAsync produce the same result for pure functions
- List accumulation preserving order
- Summary tests using TestImmTaskSeq variants (sum 1..10 = 55)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants