Mercurial > projects > dstress
diff nocompile/invariant_16.d @ 66:33346dff2640
extended invariant tests
author | thomask |
---|---|
date | Sat, 23 Oct 2004 10:09:46 +0000 |
parents | |
children | f87ba6507260 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/invariant_16.d Sat Oct 23 10:09:46 2004 +0000 @@ -0,0 +1,24 @@ +// invariant is only allowed in classes (dmd-0.104 documentation) + +module dstress.nocompile.invariant_16; + +interface MyInterface{ + private int check(); + invariant{ + assert(check()!=4); + } +} +class MyClass : MyInterface { + void test(){ + } + + private int check(){ + return 4; + } +} + +int main(){ + Myclass c = new MyClass(); + c.test(); + return 0; +}