Problem with public example in Phobos

berni44 dlang at d-ecke.de
Wed Dec 18 19:16:15 UTC 2019


On Wednesday, 18 December 2019 at 17:57:15 UTC, Steven 
Schveighoffer wrote:
> style checker has nothing to do with buildable code. It just 
> enforces the style follows the guidelines.

It also checks, that the public unittests can be used on it's 
own. (Target publictests in the makefile. Didn't know that too 
until yesterday.)

> This comes from the fact that unless you are declaring a 
> template with `template`, you are using the eponymous template 
> trick under the hood.

Aaaah. It's so common, that one forgets about it. Thanks for 
reminding. :-)

> Note, putting unittests inside templates duplicates the unit 
> test for every
> instantiation. Using an instantiation other than the template 
> itself is going
> to result in a lot of duplicated tests. Unfortunately, there is 
> no mechanism to have a documented unittest that isn't part of 
> the instantiation.

I know about that problem. Would be good, to have some such 
mechanism. Until we have, I'll resort to moving them after the 
template and adding a link to the docs, see below.

> This might be a bug. I don't know how this is built, so I'm not 
> sure. But it looks like the compiler isn't including some 
> instantiation of FormatSpec when linking.

I moved the unittest outside the template, just to find out, that 
there is allready one, which is almost identical. I merged the 
two and added a link to the docs, so people can find the example.

Thanks a lot!



More information about the Digitalmars-d-learn mailing list