Ensure @Test(arguments:) macro expansion trims trivia from argument expressions
#448
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.
This fixes a build error which can arise if the
@Test(arguments:)attribute applied to a parameterized test function includes trailing trivia such as a//-style line comment on the end of the line. For example:This regressed with my changes in #366 which began surrounding the argument expressions in a closure expression, in order to facilitate lazy evaluation. The fix ensures that the wrapped expression is trimmed, in addition to the outer closure (which was, and still is, trimmed).
Motivation:
Comments in this position may not be used often, but can be useful to provide context about the role or meaning of a particular collection of arguments passed to a parameterized test. So we'd like to continue supporting this.
Modifications:
@Testmacro expansion code.Result:
Parameterized test functions with trailing line comments on the
arguments:line now produce valid macro expansion code and build successfully.Checklist:
Resolves rdar://128609944