Skip to content

[Repo Assist] Regression test for idempotency bug with NUnit Assert.That lambda (#1740)#3232

Merged
nojaf merged 2 commits into
mainfrom
repo-assist/fix-issue-1740-idempotency-regression-test-b15031aa78b105e3
Feb 28, 2026
Merged

[Repo Assist] Regression test for idempotency bug with NUnit Assert.That lambda (#1740)#3232
nojaf merged 2 commits into
mainfrom
repo-assist/fix-issue-1740-idempotency-regression-test-b15031aa78b105e3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

Closes #1740

Summary

Adds a regression test for the idempotency bug reported in #1740, where formatting code like:

Assert.That(
    Assert.Throws(fun () -> FooFooFooFooFooFoo.BarBar.dodododo filesfiles [] outoutout |> ignore)
        .Message,
    Is.EqualTo(message)
)

...would produce a different result on second formatting (non-idempotent).

Root Cause

The bug involved incorrect indentation of a chained .Message property access after a multi-line lambda argument to Assert.Throws. The formatter was moving .Message to an inconsistent position on the second pass.

Fix

The bug is already fixed in the current codebase. The formatter now correctly collapses the expression to:

Assert.That(
    Assert.Throws(fun () -> FooFooFooFooFooFoo.BarBar.dodododo filesfiles [] outoutout |> ignore).Message,
    Is.EqualTo(message)
)

...and this output is stable across multiple formatting passes.

Test Status

✅ New test idempotency problem when formatting NUnit Assert.That with lambda, 1740 passes.
✅ No existing tests broken.

Generated by Repo Assist for issue #1740

To install this agentic workflow, run

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

…th lambda)

The bug was a non-idempotent format of Assert.Throws with a chained .Message
property access. The issue is now fixed in current Fantomas; this test ensures
it stays fixed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nojaf

nojaf commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

/repo-assist add changelog entry

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Commit pushed: f499bd8

Generated by Repo Assist

@nojaf nojaf closed this Feb 27, 2026
@nojaf nojaf reopened this Feb 27, 2026
@nojaf nojaf marked this pull request as ready for review February 27, 2026 17:19
@nojaf nojaf merged commit 8f3c408 into main Feb 28, 2026
12 checks passed
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.

Idempotency problem when formatting NUnit Assert.That

1 participant