Skip to content

[Repo Assist] tests: generative event tests and named-argument custom attribute test#477

Merged
dsyme merged 2 commits intomasterfrom
repo-assist/test-generative-events-custom-attrs-20260317-f0e347d8da5d1cfa
Mar 17, 2026
Merged

[Repo Assist] tests: generative event tests and named-argument custom attribute test#477
dsyme merged 2 commits intomasterfrom
repo-assist/test-generative-events-custom-attrs-20260317-f0e347d8da5d1cfa

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist, an AI assistant for this repository.

Summary

Two categories of testing improvement for generative type providers, both targeting previously untested code paths.

1 — Generative event tests (GenerativeEventsTests.fs, new file, 4 tests)

ProvidedEvent was used in BasicGenerativeProvisionTests.fs to construct a type, but no test ever loaded the resulting generated assembly and verified that events survived the round-trip. The new file adds:

Test What it checks
Generative instance event is present Event exists in generated assembly, EventHandlerType is correct, add/remove are instance methods
Instance event add/remove methods have correct signatures add_Changed/remove_Changed names, single EventHandler parameter
Generative static event is present Static event exists, add/remove are static methods
Generative type has expected event count Total event count is 2 (one instance + one static)

2 — Named-argument custom attribute test (BasicGenerativeProvisionTests.fs, 1 test)

Existing custom-attribute tests only exercised positional constructor arguments (ConstructorArguments). The NamedArguments encoding path in defineCustomAttrs (ProvidedTypes.fs lines 15696–15697) was reachable but untested. The new test:

  • Adds GenerativeProviderWithNamedArgAttrs — a generative type provider that attaches DebuggerDisplayAttribute("{Value}") with a named property argument Name = "MyProp" to a provided property.
  • Verifies both the constructor arg "{Value}" and the named arg Name = "MyProp" survive GetGeneratedAssemblyContentsAssembly.LoadGetCustomAttributesData().

Test Status

Passed! - Failed: 0, Passed: 117, Skipped: 0, Total: 117

(117 tests; was 110 before this PR's additions, with the delta from PRs #470 / #475 already merged.)

Generated by Repo Assist ·

To install this agentic workflow, run

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

… test

- Add GenerativeEventsTests.fs: 4 tests verifying that ProvidedEvent
  produces correct events in generated assemblies (instance and static
  events, add/remove method signatures, handler type, event count).
- Add GenerativeProviderWithNamedArgAttrs type provider and a test in
  BasicGenerativeProvisionTests.fs exercising the NamedArguments
  encoding path (lines 15696-15697 of ProvidedTypes.fs) — verifies
  DebuggerDisplayAttribute with both a constructor arg and a named
  property arg round-trips correctly through GetGeneratedAssemblyContents.

117 tests pass (was 110 before these additions).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review March 17, 2026 00:53
@dsyme dsyme merged commit 32fd603 into master Mar 17, 2026
2 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.

1 participant