Bug 11745 – Unittests retrieved by __traits(getUnitTests) can not be invoked if private.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-14T13:49:00Z
Last change time
2013-12-25T14:39:15Z
Keywords
pull
Assigned to
opantm2+dbugs
Creator
opantm2+dbugs

Comments

Comment #0 by opantm2+dbugs — 2013-12-14T13:49:05Z
Private unit tests are used to prevent documented tests from appearing as example code. But currently if a unittest is within a private: block or marked private, you may not invoke it. This means that replacement unit test frameworks aren't able to actually run the tests though the default one can. This isn't an issue with __traits(getUnitTests), but AFAIK it's the only way to actually access the tests to invoke them in the first place (excluding invoking the entire module's tests at once through ModuleInfo).
Comment #1 by doob — 2013-12-14T14:01:11Z
As a workaround you should be able to invoke the unit test function via a pointer.
Comment #2 by opantm2+dbugs — 2013-12-14T14:50:05Z
Comment #3 by github-bugzilla — 2013-12-25T14:39:01Z