[swift-evolution] [Pitch] @testable private members

Matthew Johnson matthew at anandabits.com
Sat Feb 18 12:14:16 CST 2017


When writing unit tests sometimes it is necessary to artificially elevate a member to `internal` in order to make it visible to unit tests where it could otherwise be `private` or `fileprivate`.  We could introduce an `@testable` attribute that could be applied anywhere an access modifier is used.  This attribute would elevate the access modifier to `internal` when the module is imported using the `@testable import MyModule` syntax in a test suite.

Is this something that others have interest in?  Is it something that might be considered for Swift 4 now that phase 2 has begun?

Matthew


More information about the swift-evolution mailing list