Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Aug 21, 2024

This PR adds a diagnostic if we detect that @Test has been used on a member function of an XCTestCase subclass. This was meant to be disallowed, but we neglected to add a check after adopting lexicalContext.

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 adds a diagnostic if we detect that `@Test` has been used on a member
function of an `XCTestCase` subclass. This was meant to be disallowed, but we
neglected to add a check after adopting `lexicalContext`.
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan changed the base branch from main to main-next August 21, 2024 13:46
Copy link
Contributor

@suzannaratcliff suzannaratcliff left a comment

Choose a reason for hiding this comment

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

This makes sense! Do we want to do something like this for @Suite as well?

@grynspan
Copy link
Contributor Author

@Suite already does this, note the comment I modified in SuiteDeclarationMacro.swift.

@grynspan grynspan merged commit 92bd26c into main-next Aug 21, 2024
@grynspan grynspan deleted the jgrynspan/disallow-test-in-xctestcase branch August 21, 2024 18:22
@grynspan grynspan added this to the Swift 6.1 milestone Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants