Fix ScenarioRunner using methods without result generated by testing/codegen#214
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue in the ScenarioRunner's method execution template where it was incorrectly handling methods without results. The fix ensures that methods without return values properly return nil as the first return value to match the expected (any, error) signature of the executeMethod function.
- Corrected the template to handle both methods with and without results uniformly
- Added comprehensive test coverage for scenario generation with both result types
- Renamed variables for better clarity between client methods and scenario runner code
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| testing/codegen/testdata/code.go | Renamed variables and added comprehensive test data for scenario runner code generation |
| testing/codegen/templates/scenario_runner.go.tpl | Fixed template to properly handle methods without results by returning nil as first value |
| testing/codegen/scenarios_test.go | Added new test file to verify scenario generation for both result and non-result methods |
| testing/codegen/clients_test.go | Updated variable references to match renamed test data constants |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Member
|
This is great, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.