Get module file path from ModuleInfo

Jacob Carlborg doob at me.com
Fri Jun 7 17:35:47 UTC 2019


On 2019-06-06 12:43, Andre Pany wrote:

> Also __traits(getUnitTests) does not return the module file name.
> The approach above is working fine in the d-unit library
> (https://code.dlang.org/packages/d-unit)

Well, to use __traits(getUnitTests) you need to collect all the files 
and generate a new file which imports all the files. Therefore you need 
to know the module name anyway. You can also at the mangled name of a 
unit test (returned by __traits(getUnitTests)), which will start with 
the module name. That's a bit of a hack.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list