unittest behavior

eris jvburnes at gmail.com
Mon Jul 12 10:10:35 PDT 2010


Slight clarification of unittest behavior:

- ldc will compile the unittest as long as a single reference to the class remains
- gdc will compile the unittest regardless

ie:

class A { void hello() { Stdout("hello"); }
          unittest { A myobj; myobj = new A(); a.hello() }

void main() {
   A myobj;         // without this LDC wont compile the unittest

   myobj = new A(); // not necessary for LDC to generate unittest
}

/* void main() { Stdout("hello world"); }   // this would generate unittest in gdc */



More information about the Digitalmars-d mailing list