How to unittest nested functions

Tobias Pankrath tobias at pankrath.net
Wed May 9 13:32:09 PDT 2012


How can i write a unittest for bar?

--

int foo()
{
     int bar()
     {
         return 42;
     }

     unittest { // not allowed
         assert(bar() == 42);
     }

     return bar();
}

unittest { // bar not visible
     assert(bar() == 42);
}

void main() {}


More information about the Digitalmars-d-learn mailing list