Mercurial > projects > dstress
changeset 198:8c18b61cd43d
extended foreach tests
author | thomask |
---|---|
date | Tue, 14 Dec 2004 19:35:36 +0000 |
parents | 32834cbba392 |
children | 1a77f6d93b45 |
files | run/foreach_24.d |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/foreach_24.d Tue Dec 14 19:35:36 2004 +0000 @@ -0,0 +1,21 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.compile.foreach_24; + +int main(){ + int[] x; + x.length=3; + x[0]=9; + x[1]=7; + x[2]=11; + + int y=0; + foreach(int index, int x; x){ + y+=x; + } + assert(y==27); + + return 0; +}