[Issue 20526] New: Compiling a program without unit tests with "-unittest" prints "1 unittests passed"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 23 11:02:33 UTC 2020


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

          Issue ID: 20526
           Summary: Compiling a program without unit tests with
                    "-unittest" prints "1 unittests passed"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: petar.p.kirov at gmail.com

$ cat test.d
void main()
{
    import std.algorithm.sorting : sort;
    int[] arr1 = [5, 2, 8];
    auto s = arr1.sort;
}

$ dmd -unittest test.d && ./test
1 unittests passed

The root cause is most likely a unit test nested inside a template, which gets
instantiated from std.algorithm.sorting.sort.

--


More information about the Digitalmars-d-bugs mailing list