Code That Says Exactly What It Means
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Thu Oct 30 15:19:37 UTC 2025
On 31/10/2025 4:03 AM, Dom DiSc wrote:
> On Thursday, 30 October 2025 at 03:48:01 UTC, Steven Schveighoffer wrote:
>> There has always been only ONE deficiency for this, and that is
>> documented unittests being allowed to use private symbols in the module.
>
> I consider not even this a deficiency, because unittests
> _within_the_same_module_ are per definition whitebox tests, so they
> should be allowed to use private stuff. (In C++ they are required to be
> "friends").
>
> If you want to do blackbox tests, by definition they have to be written
> in a different file (as touching the original file would be a violation
> of "blackbox"). And then they really can't see the private stuff.
>
> So, everything is fine.
>
> Having scope private would simply be lying in your pocket. Not having
> this is a clear improvement.
This isn't what Steven is talking about.
What Steven is talking about is documentation unittests.
These need to be runnable by the user, in a different module.
We've had cases where documentation unittests that are used in examples
for Phobos not work outside of the module when tried by people.
More information about the Digitalmars-d
mailing list