Skip to content

Improve XCTest import detection logic. #417

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
Oct 11, 2022

Conversation

allevato
Copy link
Member

Specifically, this will now find imports of specific decls (e.g., import class XCTest.XCTestCase) and imports inside #if blocks.

Also add some tests specifically for this logic, instead of testing it only in the context of other rules.

Fixes #403.

Specifically, this will now find imports of specific decls (e.g.,
`import class XCTest.XCTestCase`) and imports inside `#if` blocks.

Also add some tests specifically for this logic, instead of testing
it only in the context of other rules.

Fixes swiftlang#403.
@allevato
Copy link
Member Author

cc @dylansturg

import SwiftParser
import XCTest

class ImportsXCTestVisitorTests: DiagnosingTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would attributes like @_implementationOnly effect the decl? Might add a test case that has an attribute on the XCTest import.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They won't make a difference since we visit all ImportDecls and ignore the attributes.

@allevato allevato merged commit 4d1086e into swiftlang:main Oct 11, 2022
@allevato allevato deleted the conditional-xctests branch October 11, 2022 17:02
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.

Recurse into #if blocks when detecting import XCTest
2 participants