Mercurial > projects > ldc
comparison tests/mini/scope5.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/scope5.d@3587401b6eeb |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module scope5; | |
2 | |
3 int i; | |
4 | |
5 void func(int a, int b) | |
6 { | |
7 i = 0; | |
8 { | |
9 scope(exit) i++; | |
10 if (a) { | |
11 scope(exit) i++; | |
12 if (b) return; | |
13 i++; | |
14 } | |
15 } | |
16 i++; | |
17 } | |
18 | |
19 void main() | |
20 { | |
21 func(0,0); | |
22 assert(i == 2); | |
23 func(1,1); | |
24 assert(i == 2); | |
25 func(1,0); | |
26 assert(i == 4); | |
27 } |