annotate 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
rev   line source
lindquist@81 1 module scope5;
lindquist@81 2
lindquist@81 3 int i;
lindquist@81 4
lindquist@81 5 void func(int a, int b)
lindquist@81 6 {
lindquist@81 7 i = 0;
lindquist@81 8 {
lindquist@81 9 scope(exit) i++;
lindquist@81 10 if (a) {
lindquist@81 11 scope(exit) i++;
lindquist@81 12 if (b) return;
lindquist@81 13 i++;
lindquist@81 14 }
lindquist@81 15 }
lindquist@81 16 i++;
lindquist@81 17 }
lindquist@81 18
lindquist@81 19 void main()
lindquist@81 20 {
lindquist@81 21 func(0,0);
lindquist@81 22 assert(i == 2);
lindquist@81 23 func(1,1);
lindquist@81 24 assert(i == 2);
lindquist@81 25 func(1,0);
lindquist@81 26 assert(i == 4);
lindquist@81 27 }