Skip to content

[Repo Assist] tests: add GenerativeMethodsTests (6 focused method tests for generative type providers)#505

Merged
dsyme merged 2 commits intomasterfrom
repo-assist/tests-generative-methods-20260417-cba36c1b0e018357
Apr 17, 2026
Merged

[Repo Assist] tests: add GenerativeMethodsTests (6 focused method tests for generative type providers)#505
dsyme merged 2 commits intomasterfrom
repo-assist/tests-generative-methods-20260417-cba36c1b0e018357

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

Summary

Task 9 – Testing Improvements: Add GenerativeMethodsTests.fs with 6 dedicated tests for methods in generative type providers.


Changes

New: tests/GenerativeMethodsTests.fs

Six tests covering methods in generative type providers:

  1. Instance method is present — verifies Greet() is emitted, is non-static
  2. Instance method return type — verifies Greet() returns string with no parameters
  3. Instance method with parameters — verifies Add(x: int, y: int) : int has correct parameter names, types, and return type
  4. Static method is present — verifies Create() is emitted as a static method returning obj
  5. Method lookup by name — calls GetMethod(name) for all three methods; directly exercises the ILMethodDefs lazy name-lookup dictionary
  6. Method count — verifies the exact number of declared methods on the generated type

Updated: tests/FSharp.TypeProviders.SDK.Tests.fsproj

Added GenerativeMethodsTests.fs to the compile group (after GenerativeDelegateTests.fs).


Motivation

The existing tests exercise methods indirectly (e.g. via BasicGenerativeProvisionTests.fs) but there was no dedicated, self-contained file for method reflection on generative types — unlike the dedicated files already present for events, delegates, enums, interfaces, structs, abstract classes, and equality comparisons. Having a focused file makes it easier to diagnose regressions and documents the expected method-reflection contract.


Test Status

137/137 tests pass (baseline was 131; 6 new tests added, all green)

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

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

To install this agentic workflow, run

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

Adds GenerativeMethodsTests.fs covering instance methods, methods with
parameters, static methods, method name lookup (exercises ILMethodDefs
lazy dictionary), and method count for generative type providers.

137/137 tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review April 17, 2026 10:41
@dsyme dsyme merged commit bbea8e0 into master Apr 17, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Apr 19, 2026
…tom attr encoding); prepare release 8.7.0

Adds GenerativeCustomAttributeTests.fs with 5 focused tests covering
custom attribute encoding in the generative IL writer for attribute
targets and argument types not previously exercised:

- ObsoleteAttribute(string, bool) on the generated TYPE ITSELF
- DescriptionAttribute(string) on an instance METHOD
- Multiple attributes on the same method (all-attrs preserved path)
- DebuggerBrowsableAttribute(DebuggerBrowsableState) on a property
  (enum argument round-trip via underlying int)
- Scalar bool argument round-trip

Also updates RELEASE_NOTES.md with 8.7.0 entry covering this and
the previously-merged GenerativeMethodsTests (#505).

All 147 tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme pushed a commit that referenced this pull request Apr 20, 2026
…ase 8.7.0 (#506)

🤖 *This is an automated pull request from Repo Assist.*

## Summary

Adds `GenerativeCustomAttributeTests.fs` — 5 regression tests for custom
attribute encoding in the generative IL writer. These cover attribute
targets and argument types not previously exercised by the existing
tests in `BasicGenerativeProvisionTests.fs` (which only tested
attributes on *properties*).

Also updates `RELEASE_NOTES.md` with a new `8.7.0` entry covering this
and the previously-merged `GenerativeMethodsTests` (#505).

## New tests

| Test | What it verifies |
|------|-----------------|
| `Custom attribute on a generative type round-trips correctly` |
`ObsoleteAttribute(string, bool)` placed on the *type definition itself*
|
| `Custom attribute with bool constructor argument round-trips
correctly` | `bool` values survive the ECMA-335 encode/decode path |
| `Custom attribute with enum constructor argument round-trips
correctly` | `DebuggerBrowsableAttribute(DebuggerBrowsableState.Never)`
— enum arg decoded as underlying int |
| `Multiple custom attributes on a single generative method are all
preserved` | `defineCustomAttrs` writes **all** attributes, not just the
first |
| `Custom attribute on a generative method has correct string argument`
| `DescriptionAttribute(string)` on an instance method |

## Root cause / motivation

Several custom-attribute encoding bugs were fixed in earlier PRs
(`#432`, `#490`, `#501`). This PR adds focused regression tests for the
remaining un-covered paths:
- attributes on **types** (not just members)  
- attributes on **methods** (not just properties)  
- **bool** and **enum** constructor argument encoding  
- multiple attributes on a single member

## Test Status

```
Passed! - Failed: 0, Passed: 147, Skipped: 0, Total: 147, Duration: 7 s
```
All 147 tests pass (142 pre-existing + 5 new).




> Generated by 🌈 Repo Assist, see [workflow
run](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/24617397828).
[Learn
more](https://github.com/githubnext/agentics/blob/main/docs/repo-assist.md).
>
> To install this [agentic
workflow](https://github.com/githubnext/agentics/blob/97143ac59cb3a13ef2a77581f929f06719c7402a/workflows/repo-assist.md),
run
> ```
> gh aw add
githubnext/agentics@97143ac
> ```

<!-- gh-aw-agentic-workflow: Repo Assist, engine: copilot, model: auto,
id: 24617397828, workflow_id: repo-assist, run:
https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/24617397828
-->

<!-- gh-aw-workflow-id: repo-assist -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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