Skip to content

Rework ImportsXCTestVisitor class#1244

Draft
bkhouri wants to merge 1 commit into
swiftlang:mainfrom
bkhouri:t/main/gh1243_update_neverusefortry_to_support_all_test_library
Draft

Rework ImportsXCTestVisitor class#1244
bkhouri wants to merge 1 commit into
swiftlang:mainfrom
bkhouri:t/main/gh1243_update_neverusefortry_to_support_all_test_library

Conversation

@bkhouri

@bkhouri bkhouri commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The ImportsXCTestVisitor class was too restrictive. Rename the class to ImportsAnyTestingLibrary and have the visitor class support both XCTest and/or Swift Testing library.

The list of "supported" testing modules are store in a property, which can be augmented in the future.

Closes #1243

@bkhouri bkhouri force-pushed the t/main/gh1243_update_neverusefortry_to_support_all_test_library branch from 5c4e4f3 to 6cde7e3 Compare July 10, 2026 22:12
@bkhouri bkhouri changed the title Update ImportsXCTestVisitor class Rework ImportsXCTestVisitor class Jul 10, 2026
@bkhouri

bkhouri commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

The API breakage check build failed with the following

3 breaking changes detected in SwiftFormat:
  💔 API breakage: var Context.importsXCTest has declared type change from SwiftFormat.Context.XCTestImportState to SwiftFormat.Context.AnyTestImportState
  💔 API breakage: accessor Context.importsXCTest.Get() has return type change from SwiftFormat.Context.XCTestImportState to SwiftFormat.Context.AnyTestImportState
  💔 API breakage: accessor Context.importsXCTest.Set() has been removed

These are expected as those have been deprecated and replaced with another. how do we address this?

The `ImportsXCTestVisitor` class was too restrictive.  Rename the class
to `ImportsAnyTestingLibrary` and have the visitor class support both
XCTest and/or Swift Testing library.

The list of "supported" testing modules are store in a property, which
can be augmented in the future.

Closes swiftlang#1243
@bkhouri bkhouri force-pushed the t/main/gh1243_update_neverusefortry_to_support_all_test_library branch from 6cde7e3 to 7d7d3ab Compare July 10, 2026 22:30
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.

NeverUseForceTry is applied to Swift Testing test code.

1 participant