Open
Description
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 useprivate
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.