Get module file path from ModuleInfo
Jacob Carlborg
doob at me.com
Thu Jun 6 10:16:17 UTC 2019
On Thursday, 6 June 2019 at 04:20:52 UTC, Andre Pany wrote:
> Hi,
>
> I want to enhance a unittest framework to also report the
> results in SonarQube Generic Execution format. This format
> lists the file paths.
>
> The unittest framework loops through the modules and collects
> the module name and the unittests:
>
> foreach (moduleInfo; ModuleInfo)
> {
> if (moduleInfo)
> {
> auto unitTest = moduleInfo.unitTest;
>
> if (unitTest)
> {
> testClass.name = moduleInfo.name;
> testClass.test = (o, test) { unitTest(); };
> testClasses ~= testClass;
> }
> }
> }
>
> Is there any way to get the module file path (the value
> __FILE__ would contain in the modules)?
>
>
> Kind regards
> André
No, I think you have to use `__traits(getUnitTests)`.
—
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list