on Wed Sep 21 2016, Benjamin Spratling <swift-evolution@swift.org> wrote:

> Howdy,
> As I understand it, In Swift 3, a lack of encapsulation is testable,
> but specific keywords to protect a designed encapsulation can’t be
> introspected, and thus encapsulation is fragile, i.e. not protectable
> by unit tests.
> For instance, we can write unit-tests that determine if a member's
> access level is at least a given level.  (by writing a test which
> accesses it at that level.)  However, we cannot test that it is less
> than, or exactly at a specific level.  

You can certainly write tests that only succeed when compilation fails.
Another option would be to use SourceKit to get a programmatic
representation of the code and check that.



swift-evolution mailing list

Reply via email to