test: cover state machine generator edge cases#419
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
Adds additional TinyBDD/xUnit scenarios to increase maintained-source coverage for StateMachineGenerator edge cases, continuing the generator-coverage work in #413.
Changes:
- Add scenario covering hook collection behavior when hook enum values are signed/negative,
null, or unknown. - Add scenario asserting diagnostics for invalid
CancellationTokenparameter signatures on transitions/guards/hooks. - Add scenario covering invalid-trigger policy emission when a state machine defines no transitions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [Scenario("NamedHookArgumentsAndSignedEnums CoverHookCollectionBranches")] | ||
| [Fact] | ||
| public void NamedHookArgumentsAndSignedEnums_CoverHookCollectionBranches() | ||
| { |
| static void AssertDiagnostic(string source, string id, string assemblyName) | ||
| { | ||
| var comp = RoslynTestHelpers.CreateCompilation(source, assemblyName); | ||
| var gen = new StateMachineGenerator(); | ||
| _ = RoslynTestHelpers.Run(comp, gen, out var result, out _); | ||
| ScenarioExpect.Contains(result.Results.SelectMany(r => r.Diagnostics), d => d.Id == id); | ||
| } |
Test Results 12 files 12 suites 9m 53s ⏱️ Results for commit 030d14b. |
Code Coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #419 +/- ##
==========================================
+ Coverage 89.74% 95.81% +6.07%
==========================================
Files 551 551
Lines 44183 44183
Branches 6357 6357
==========================================
+ Hits 39650 42333 +2683
+ Misses 2018 1850 -168
+ Partials 2515 0 -2515
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:
|
🔍 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. |
Summary
Coverage
Validation