Skip to content

[Repo Assist] test: add SideEffects module to TaskSeq.Unfold.Tests.fs - #405

Merged
dsyme merged 5 commits into
mainfrom
repo-assist/test-unfold-sideeffects-20260423-240f686bd62cbcbc
May 1, 2026
Merged

[Repo Assist] test: add SideEffects module to TaskSeq.Unfold.Tests.fs#405
dsyme merged 5 commits into
mainfrom
repo-assist/test-unfold-sideeffects-20260423-240f686bd62cbcbc

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist, an AI assistant.

Summary

TaskSeq.Unfold.Tests.fs had EmptySeq and Functionality modules but was missing a SideEffects module, unlike most other test files in the suite.

This PR adds a SideEffects module with 6 new tests:

New tests

  1. unfold generator side-effects accumulate across re-iterations (sync): Closes over mutable external state; verifies that re-iterating calls the generator fresh from the initial seed but the external counter keeps climbing — 4 calls per iteration (3 Some + 1 None), so 8 total after two iterations.

  2. unfoldAsync generator side-effects accumulate across re-iterations (async): Same verification for the async variant.

  3. unfold with take stops generator calls at the limit (sync): An always-Some infinite generator combined with take 5; proves the generator is called exactly 5 times — no extra sentinel call is needed when the source never returns None.

  4. unfoldAsync with take stops generator calls at the limit (async): Same for the async variant.

  5. unfold propagates exception thrown inside the generator: Verifies that a failwith at n = 3 surfaces as System.Exception when the sequence is consumed.

  6. unfoldAsync propagates exception thrown inside the async generator: Same for the async variant.

Test growth

BeforeAfter
14 test runs20 test runs

Test Status

  • Build: ✅ dotnet build src/FSharp.Control.TaskSeq.Test -c Release — succeeded (0 warnings, 0 errors)
  • Tests: ✅ dotnet test --filter Unfold -c Release20 passed, 0 failed
  • Format: ✅ dotnet fantomas src/.../TaskSeq.Unfold.Tests.fs --check — clean

Generated by 🤖 Repo Assist, see workflow run.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Adds 6 new tests covering:
- Generator side-effects accumulate across re-iterations (both sync and async)
- take stops the generator after the requested number of elements
- Exceptions thrown inside sync and async generators propagate correctly
Before: 14 test runs After: 20 test runs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme
dsyme marked this pull request as ready for review April 23, 2026 09:32
@github-actionsgithub-actionsBot mentioned this pull request May 1, 2026
6 tasks
@dsyme
dsyme merged commit 2247470 into mainMay 1, 2026
5 checks passed
@dsyme
dsyme deleted the repo-assist/test-unfold-sideeffects-20260423-240f686bd62cbcbc branch May 1, 2026 17:29
Sign up for freeto 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.

1 participant

@dsyme