test: cover adapter generator edge cases#420
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Hardens the Adapter source generator so malformed [AdapterMap] methods on single-adapter hosts surface as precise PKADP005 signature diagnostics instead of being silently dropped (which previously produced misleading PKADP003 "missing mapping" errors), and adds extensive TinyBDD test coverage to raise AdapterGenerator coverage from 95.4% to 99.2%.
Changes:
- In
GetMappingMethods, count[GenerateAdapter]attributes on the host and only filter mappings by first-parameter adaptee type for multi-adapter hosts; single-adapter hosts retain all[AdapterMap]-annotated methods for downstream signature validation. - Add new TinyBDD scenarios covering unbound generic adaptees, malformed first-parameter cases (missing, wrong type,
ref,this,scoped), method/property arity & type mismatches, abstract base + internal-ctor +ref readonly/enum-default emission, and metadata-only target/conflict paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/PatternKit.Generators/Adapter/AdapterGenerator.cs |
Branches mapping discovery by adapter attribute count so single-adapter hosts preserve malformed maps for PKADP005 reporting. |
test/PatternKit.Generators.Tests/AdapterGeneratorTests.cs |
Adds three scenarios covering invalid map signatures, abstract-base + ref readonly/enum-default emission, and metadata-only target/conflict paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 12 files 12 suites 7m 4s ⏱️ Results for commit 77e358a. |
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #420 +/- ##
==========================================
+ Coverage 89.81% 95.86% +6.04%
==========================================
Files 551 551
Lines 44183 44186 +3
Branches 6357 6359 +2
==========================================
+ Hits 39684 42359 +2675
+ Misses 1990 1827 -163
+ Partials 2509 0 -2509
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Coverage |
Summary
Part of #413.
Validation