Skip to content

Record property accesses in capturing mocks - #547

Merged
Smaug123 merged 4 commits into
mainfrom
capturing-mock-property-calls
Jul 10, 2026
Merged

Record property accesses in capturing mocks#547
Smaug123 merged 4 commits into
mainfrom
capturing-mock-property-calls

Conversation

@Smaug123

@Smaug123 Smaug123 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Last fix split out of #540; independent of the Swagger stack (#542#546) — it touches only the capturing-mock generator and its generated file, so it can merge in any order.

The capturing mock's Calls record has an entry per property, but the generated property implementations invoked only the configured function and never appended to those logs, so Calls.Prop1/Calls.Prop2 stayed empty forever. Property getters now record into Calls under a lock, mirroring the method implementations:

member this.Prop1 =
    lock this.Calls.Prop1 (fun _ -> this.Calls.Prop1.Add ())
    this.Prop1 ()

Test was written first and observed failing (counts stayed at 0 after access).

🤖 Generated with Claude Code

The capturing mock's Calls record has an entry per property, but the
generated property implementations invoked only the configured function
and never appended to those logs, so the call arrays stayed empty
forever. Property getters now record into Calls under a lock, mirroring
the method implementations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Smaug123
Smaug123 enabled auto-merge (squash) July 10, 2026 09:47
@Smaug123
Smaug123 merged commit 4cb726a into main Jul 10, 2026
19 checks passed
@Smaug123
Smaug123 deleted the capturing-mock-property-calls branch July 10, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant