fixed issue fix/#4269 Improved GoDoc in test_helpers.go #4270
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.
Expected Effect
I have made it clearer when and how to use these helper functions by making the GoDoc comments a bit more detailed.
Changes
CreateTestContext:
comments from “Returns a new engine and context for testing purposes” to "Useful for tests that require setting up a new Gin engine instance and its associated context. For example, when testing middleware that does not depend on a specific route." We have made this more specific with
CreateTestContextOnly:
Comment was changed from “Returns a new context based on the engine for testing purposes” to “Useful for tests that run on an existing, possibly preconfigured, Gin engine instance and need a new context for it.” We have made this more specific.
Also, added the information that “Contexts are allocated from the provided engine with the maxParams setting.” to clarify the behavior regarding the allocateContext argument.