[Issue 22596] New: The "publictests" target runs unittests at the top-level namespace so they don't have access to

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 13 21:30:45 UTC 2021


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

          Issue ID: 22596
           Summary: The "publictests" target runs unittests at the
                    top-level namespace so they don't have access to
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Consider:

import std.stdio;

template canon(string v) {
    unittest {
        writeln(v);
    }
}

void main() {
    alias x = canon!"abc";
}

The unittest works properly because it has access to `v` being nested inside
the `canon` template. However, putting this unittest inside phobos and running
this will fail:

make publictests

It seems this is because that target uses a unittest extractor that does not
handle nested unittests properly.

--


More information about the Digitalmars-d-bugs mailing list