Skip to content

[stdlibUnittest, 6.2] generalize expectNil(_:) #82703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

glessard
Copy link
Contributor

@glessard glessard commented Jul 1, 2025

Explanation:
Generalize StdlibUnittest's expectNil(_:) function for non-copyable and non-escapable parameter types. Useful for testing failable UTF8Span initializers, for example.
This generalization adds an overload, because simply generalizing would remove functionality. The original version prints an unexpected value using string interpolation. The string interpolation machinery cannot handle a non-escapable or non-copyable parameter value yet, so we instead add a version that can handle such values but does not print. Merging these is left for future work.

Resolves: rdar://154522348 (by unbreaking the 32-bit testing path)

Risk: Low. Makes more code possible, and is source-compatible with the previously-existing function.

Main branch PR: #82701

Review by: @stephentyrone

Testing: added specific test, and existing tests show source-compatibility.

@glessard
Copy link
Contributor Author

glessard commented Jul 1, 2025

@swift-ci please test

@glessard
Copy link
Contributor Author

glessard commented Jul 2, 2025

@swift-ci please test

@glessard
Copy link
Contributor Author

glessard commented Jul 2, 2025

@swift-ci please test macOS platform

@glessard glessard marked this pull request as ready for review July 2, 2025 21:16
@glessard glessard requested a review from a team as a code owner July 2, 2025 21:16
@glessard glessard merged commit a348c51 into swiftlang:release/6.2 Jul 3, 2025
5 checks passed
@glessard glessard deleted the rdar154776967-generalize-expectNil-62 branch July 3, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants