http://d.puremagic.com/issues/show_bug.cgi?id=5038
Summary: Change class 'invariant' syntax to emulate 'unittest'
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Austin Hastings <[email protected]> 2010-10-10 15:09:58
PDT ---
Presently a class invariant is required to be a single function:
class C {
int height;
int width;
invariant() {
assert( height < 10 );
assert( width < 11 );
}
}
For large and/or complex classes, it would improve locality if the invariant
could be specified piecemeal, in much the same was that unittest blocks are
stitched together into a whole:
class C {
int height;
invariant {
assert( height < 10 );
}
int width;
invariant {
assert( width < 11 );
}
}
The parentheses after invariant seem useless, too - also very much like
unittest.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------