Inconsistent behavior of __FILE__ within mixin template

Andre Pany andre at s-e-a-p.de
Wed May 29 18:02:10 UTC 2019


On Wednesday, 29 May 2019 at 16:08:11 UTC, Exil wrote:
> On Wednesday, 29 May 2019 at 08:45:45 UTC, Andre Pany wrote:
>> [...]
>
> I imagine __FILE__ is used where the code is defined, since it 
> is defined in "a.d" that is what is used. If you want to know 
> the file name of where it is used then you can add it as part 
> of the template.
>
> mixin template UnitTest(string filename = __FILE__)
> {
>     private static this()
>     {
>         testClasses ~= TestClass(this.classinfo.name, filename 
> );
>     }
> }

Thanks a lot. That looks great.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list