Skip to content

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

Open
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/test-unfold-sideeffects-20260423-240f686bd62cbcbc
Open

[Repo Assist] test: add SideEffects module to TaskSeq.Unfold.Tests.fs#405
github-actions[bot] wants to merge 2 commits intomainfrom
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

Before After
14 test runs 20 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 <[email protected]>
@dsyme dsyme marked this pull request as ready for review April 23, 2026 09:32
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