www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11255] New: Support for inner unittests


           Summary: Support for inner unittests
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-10-14 02:55:43 PDT ---
void main() {
    int sqr(int x) { return x ^^ 2; }
    unittest {
        assert(sqr(3) == 9);

dmd 2.064beta gives:

test.d(3): Error: found 'unittest' instead of statement
test.d(6): Error: unrecognized declaration

This is kind of necessary to make nested functions usable in real code, because
in some cases you can't avoid writing some unit tests for a function.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013