www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21333] New: runModuleUnitTests inner code should be available

https://issues.dlang.org/show_bug.cgi?id=21333

          Issue ID: 21333
           Summary: runModuleUnitTests inner code should be available as a
                    function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

Currently, in order to affect the behavior of the default unit tester, you must
reimplement it.

In this code:
https://github.com/dlang/druntime/blob/86e5cf3fa15afda116994da0c91f40aa7a5e6c6e/src/core/runtime.d#L562

If you define a default unit tester, it skips the normal running of unittests.
The meat of actually running the unit tests should be abstracted into a
function, such that you can call it but just affect the result (like if you
don't want to run main, but you want to suppress a successful output).

Simple fix, just abstract the unit test running into its own function.

--
Oct 20 2020