Mercurial > projects > dstress
diff run/c/catch_05_E.d @ 593:6ee3b4b671c1
forach and throw/catch code generation
Nick <Nick_member@pathlink.com>
2005-06-21
news:d99id2$fgj$1@digitaldaemon.com
author | thomask |
---|---|
date | Wed, 22 Jun 2005 17:15:46 +0000 |
parents | |
children | f4e98d870b57 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/catch_05_E.d Wed Jun 22 17:15:46 2005 +0000 @@ -0,0 +1,46 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Nick <Nick_member@pathlink.com> +// @date@ 2005-06-21 +// @uri@ news:d99id2$fgj$1@digitaldaemon.com +// @desc@ foreach and throw/catch code generation + +module dstress.run.c.catch_05_E; + +int counter; + +void dummy(){ + counter++; +} + +int bb[char[]]; + +int main(){ + + assert(counter==0); + + foreach(int i; bb){ + dummy(); + } + + assert(counter==0); + + bb["a"] = 1; + + foreach(int b; bb){ + try{ + throw new Error("foo"); + }catch(Error e){ + assert(e); + assert(counter==0); + return 0; + }catch{ + assert(0); + } + assert(0); + } + + assert(0); +}