[Issue 10992] New: Trait getUnitTests skips first test if aggregate contains multiple tests.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 8 00:05:10 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10992

           Summary: Trait getUnitTests skips first test if aggregate
                    contains multiple tests.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: opantm2+dbugs at gmail.com


--- Comment #0 from Kapps <opantm2+dbugs at gmail.com> 2013-09-08 00:05:09 PDT ---
When using __traits(getUnitTests) on an aggregate that contains more than one
unittest, the first test will be skipped. If there is only one test, that
single test will be included.

Example:

import std.stdio;

unittest {
    writeln("Test 1");
}

unittest {
    writeln("Test 2");
}

unittest {
    writeln("Test 3");
}

void main() {
    writeln("main");
    foreach(t; __traits(getUnitTests, mixin(__MODULE__))) {
        t();
    }
}

Output (note that the tests should be run twice; once by default test runner):
Test 1
Test 2
Test 3
main
Test 2
Test 3

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list