Skip to content
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

Ability to write tests right in the same file #795

Open
MahdiBM opened this issue Nov 2, 2024 · 1 comment
Open

Ability to write tests right in the same file #795

MahdiBM opened this issue Nov 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@MahdiBM
Copy link

MahdiBM commented Nov 2, 2024

Description

It would be nice if we had the ability to write test in the same file, and not in files far away in a dedicated Tests folder.
This will have some benefits like:

  • The code and the tests are just simply closer apart.
  • We could use access modifiers like fileprivate to test parts of the code in the same file, instead of having to workaround this by @testable importing which makes users have to not use private access modifiers just to be able to test a function. Or using stuff like @_spi.

Languages like Rust do support this.

I saw some discussions about this a few months ago, I think the compiler needs to support better discovery of stuff like tests for this to be possible.

@MahdiBM MahdiBM added the enhancement New feature or request label Nov 2, 2024
@grynspan
Copy link
Contributor

grynspan commented Nov 4, 2024

Tracked internally as rdar://112339873.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants