# HG changeset patch # User thomask # Date 1175768899 0 # Node ID d0ab95b049269c91c6e1ec2da3450a7f19e60706 # Parent 872b6f641b5d41d6ae2edd617dd52858b2a38377 [Issue 815] scope(exit) isn't executed when "continue" is used to continue a while-loop Thomas K?hne 2007-01-07 http://d.puremagic.com/issues/show_bug.cgi?id=815 diff -r 872b6f641b5d -r d0ab95b04926 run/s/scope_18_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/scope_18_A.d Thu Apr 05 10:28:19 2007 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Thomas Kühne +// @date@ 2007-01-07 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=815 +// @desc@ [Issue 815] scope(exit) isn't executed when "continue" is used to continue a while-loop + +module dstress.run.s.scope_18_A; + +int main(){ + int[] log; + int i = 3; + + while(i--){ + scope(exit){ + log ~= 0xEE; + } + log ~= i; + + if(i % 2){ + continue; + } + log ~= 0xFF; + } + + if([2, 0xFF, 0xEE, 1, 0xEE, 0, 0xFF, 0xEE] != log){ + assert(0); + } + + return 0; +} diff -r 872b6f641b5d -r d0ab95b04926 run/s/scope_18_B.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/scope_18_B.d Thu Apr 05 10:28:19 2007 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Thomas Kühne +// @date@ 2007-01-07 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=815 +// @desc@ [Issue 815] scope(exit) isn't executed when "continue" is used to continue a while-loop + +module dstress.run.s.scope_18_B; + +int main(){ + int[] log; + int i = 3; + + while(i--){ + scope(success){ + log ~= 0xEE; + } + log ~= i; + + if(i % 2){ + continue; + } + log ~= 0xFF; + } + + if([2, 0xFF, 0xEE, 1, 0xEE, 0, 0xFF, 0xEE] != log){ + assert(0); + } + + return 0; +} diff -r 872b6f641b5d -r d0ab95b04926 run/s/scope_18_C.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/scope_18_C.d Thu Apr 05 10:28:19 2007 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Thomas Kühne +// @date@ 2007-01-07 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=815 +// @desc@ [Issue 815] scope(exit) isn't executed when "continue" is used to continue a while-loop + +module dstress.run.s.scope_18_C; + +int main(){ + int[] log; + int i = 3; + + while(i--){ + scope(failure){ + log ~= 0xEE; + } + log ~= i; + + if(i % 2){ + continue; + } + log ~= 0xFF; + } + + if([2, 0xFF, 1, 0, 0xFF] != log){ + assert(0); + } + + return 0; +}