Is it a bug in unittest ?

angel via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 1 11:11:55 PDT 2016


If one creates a unittest block in a templated class (or struct), 
the unittest block will be multiplied per class specialization, 
which might turn out to be quite large number.

E.g.
  struct A(T) {
      ...
      unittest {
          ...
      }
  }

  ...

  auto a = A!int;
  auto b = A!int;
  auto c = A!double;

The unittest block will be instantiated twice (per A!int and 
A!double).
But in some (many ?) cases unittest doesn't even exercise the 
generics, merely using some particular type.

What is it, a bug ?


More information about the Digitalmars-d mailing list