| 1 |
// REQUIRED_ARGS: -check=in=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, "out"); } // triggered |
| 8 |
do |
| 9 |
{ |
| 10 |
return a; |
| 11 |
} |
| 12 |
|
| 13 |
invariant // skipped |
| 14 |
{ |
| 15 |
assert(false); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
void main() |
| 20 |
{ |
| 21 |
import core.exception : AssertError; |
| 22 |
|
| 23 |
auto c = new C; |
| 24 |
bool catched; |
| 25 |
try |
| 26 |
c.foo(0); |
| 27 |
catch (AssertError e) |
| 28 |
{ |
| 29 |
assert(e.msg == "out"); |
| 30 |
catched = e.msg == "out"; |
| 31 |
} |
| 32 |
|
| 33 |
if (!catched) |
| 34 |
assert(0); |
| 35 |
} |