Skip to content

Miscellaneous bookkeeping/cleanup of _TestDiscovery. #1055

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
merged 1 commit into from
Apr 7, 2025

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Apr 7, 2025

This PR has a few minor changes:

  • The default implementation of DiscoverableAsTestContent._testContentTypeNameHint is not present if SWT_NO_LEGACY_TEST_DISCOVERY is defined;
  • Fixed the precondition in TestContentKind.init(stringLiteral:) so it doesn't call utf8CodeUnitCount on single-character static strings;
  • The implementation of TestContentKind._fourCCValue uses isprint() to check if the kind value looks like a FourCC rather than calling ICU-based functions;
  • Fixed a type in a comment on SectionBounds.Kind.segmentAndSectionName; and
  • Simplified the implementation of TestContentKind.commentRepresentation (in the macro target).

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR has a few minor changes:

- The default implementation of `DiscoverableAsTestContent._testContentTypeNameHint`
  is not present if `SWT_NO_LEGACY_TEST_DISCOVERY` is defined;
- Fixed the precondition in `TestContentKind.init(stringLiteral:)` so it doesn't
  call `utf8CodeUnitCount` on single-character static strings;
- The implementation of `TestContentKind._fourCCValue` uses `isprint()` to check
  if the kind value looks like a FourCC rather than calling ICU-based functions;
- Fixed a type in a comment on `SectionBounds.Kind.segmentAndSectionName`; and
- Simplified the implementation of `TestContentKind.commentRepresentation` (in
  the macro target).
@grynspan grynspan added bug 🪲 Something isn't working macros 🔭 Related to Swift macros such as @Test or #expect discovery 🔎 test content discovery labels Apr 7, 2025
@grynspan grynspan added this to the Swift 6.x milestone Apr 7, 2025
@grynspan grynspan self-assigned this Apr 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Apr 7, 2025

@swift-ci test

@grynspan grynspan merged commit 526ef76 into main Apr 7, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/test-discovery-cleanup branch April 7, 2025 17:56
grynspan added a commit that referenced this pull request Apr 7, 2025
This PR has a few minor changes:

- The default implementation of
`DiscoverableAsTestContent._testContentTypeNameHint` is not present if
`SWT_NO_LEGACY_TEST_DISCOVERY` is defined;
- Fixed the precondition in `TestContentKind.init(stringLiteral:)` so it
doesn't call `utf8CodeUnitCount` on single-character static strings;
- The implementation of `TestContentKind._fourCCValue` uses `isprint()`
to check if the kind value looks like a FourCC rather than calling
ICU-based functions;
- Fixed a type in a comment on
`SectionBounds.Kind.segmentAndSectionName`; and
- Simplified the implementation of
`TestContentKind.commentRepresentation` (in the macro target).

### 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.
grynspan added a commit that referenced this pull request Apr 8, 2025
- **Explanation**: Some minor code cleanup in/around the
`_TestDiscovery` module.
  - **Scope**: Internal only
  - **Issues**: N/A
  - **Original PRs**: #1055 
  - **Risk**: Low (nothing obvious)
  - **Testing**: The usual CI jobs.
  - **Reviewers**: @briancroom
@stmontgomery stmontgomery modified the milestones: Swift 6.x, Swift 6.2 Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working discovery 🔎 test content discovery macros 🔭 Related to Swift macros such as @Test or #expect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants