| 1 |
// REQUIRED_ARGS: -check=in=off -check=out=off -check=invariant=off |
| 2 |
// PERMUTE_ARGS: |
| 3 |
class C |
| 4 |
{ |
| 5 |
int foo(int a) |
| 6 |
in { assert(a != 0); } // skipped |
| 7 |
out(res) { assert(res != 0); } // skipped |
| 8 |
do |
| 9 |
{ |
| 10 |
return a; |
| 11 |
} |
| 12 |
|
| 13 |
invariant // skipped |
| 14 |
{ |
| 15 |
assert(false); |
| 16 |
} |
| 17 |
|
| 18 |
void bar(int a) |
| 19 |
{ |
| 20 |
assert(a != 0); // triggered |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
void main() |
| 25 |
{ |
| 26 |
import core.exception : AssertError; |
| 27 |
|
| 28 |
auto c = new C; |
| 29 |
c.foo(0); |
| 30 |
|
| 31 |
bool catched; |
| 32 |
try |
| 33 |
c.bar(0); |
| 34 |
catch (AssertError e) |
| 35 |
catched = true; |
| 36 |
if (!catched) |
| 37 |
assert(0); |
| 38 |
} |