Rethink OOP access permissions

Dom DiSc dominikus at scherkl.de
Tue Apr 30 13:17:59 UTC 2024


On Sunday, 28 April 2024 at 08:15:14 UTC, NotYouAgain wrote:
> This unittest below will pass, but it really should not.

There you have a point.
Most of the time I like to be able to use private stuff in my 
unit-tests (white-box tests), but if the purpose of the test is 
to check for correct encapsulation (black-box tests), then it 
must not have access to this.

On the other hand, one could argue that black-box tests _need_ to 
be in a different module, because else it's not a black-box to 
them anymore (writing a black-box test shall not modify the 
subject under test - which is impossible if it is in the same 
file).


More information about the dip.ideas mailing list