-
Notifications
You must be signed in to change notification settings - Fork 120
Emit a diagnostic if a display name string is empty #1256
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
Emit a diagnostic if a display name string is empty #1256
Conversation
Fixes rdar://157603034
@swift-ci please test |
@swift-ci please test Linux |
1 similar comment
@swift-ci please test Linux |
Should we give it a fix-it to remove the display name? Also, have you read the compiler diagnostic style guide? It might help you find the right voice for the message. |
Sources/TestingMacros/Support/Additions/StringLiteralExprSyntaxAdditions.swift
Outdated
Show resolved
Hide resolved
@swift-ci please test |
@swift-ci please test Linux |
Added a fix-it to remove the display name argument!
I've now read the guide. Among its recommendations I saw:
Based on that, I feel like the severity of this should be a warning and not an error. In terms of the phrasing of the diagnostic message I'm still open to suggestions. I didn't see much in the style guide that would contradict my current phrasing but I could also imagine saying "Display name string is empty" rather than saying it "should not" be empty. |
@swift-ci test |
@swift-ci test |
@swift-ci test Windows |
@swift-ci test |
@swift-ci test |
No functional change: just adds new test cases for the change in swiftlang#1256 * Moved the tests previously added to `apiMisuseErrors` -> `apiMisuseErrorsIncludingFixIts`, and include the expected fixits It would probably be ok to leave them in `apiMisuseErrors` as well, but I think it would be kinda redundant since we also test the expected message along with the fixits already.
No functional change: adds new test cases for the change in #1256 Moved the tests previously added to `apiMisuseErrors` -> `apiMisuseErrorsIncludingFixIts`, and include the expected fixits It would probably be ok to leave them in `apiMisuseErrors` as well, but I think it would be kinda redundant since we also test the expected message along with the fixits already. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
This introduces an error diagnostic emitted from the testing library's
@Test
and@Suite
macros if the display name string literal is empty. For example:Fixes rdar://157603034
Motivation:
It's not recommended for the display name string to be empty since it can cause confusing test results.
Checklist: