www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14789] New: Runtime test reflection is broken

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

          Issue ID: 14789
           Summary: Runtime test reflection is broken
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: public dicebot.lv

// wat.d
import core.runtime;
import std.stdio;

unittest
{
    writeln("in test");
    assert(false);
}

bool dummyUnitTestRunner()
{
    foreach ( m; ModuleInfo )
    {
        if (m.unitTest !is null)
        {
            writefln("running tests for %s", m.name);
            m.unitTest();
        }   
    }   

    return true;
}

static this ( ) 
{
    Runtime.moduleUnitTester(&dummyUnitTestRunner);
}

// output:
// running tests for wat

--
Jul 08 2015