Mercurial > projects > dstress
changeset 183:1c473946386f
extended foreach tests
author | thomask |
---|---|
date | Thu, 09 Dec 2004 06:08:48 +0000 |
parents | 2006052ab834 |
children | 2f17af7c6359 |
files | nocompile/foreach_17.d nocompile/foreach_18.d nocompile/foreach_19.d nocompile/foreach_20.d nocompile/foreach_21.d nocompile/foreach_22.d run/foreach_23.d |
diffstat | 7 files changed, 73 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/nocompile/foreach_17.d Thu Dec 09 03:26:52 2004 +0000 +++ b/nocompile/foreach_17.d Thu Dec 09 06:08:48 2004 +0000 @@ -2,12 +2,12 @@ // $Date$ // $Author$ -// onyl "" and "inout" are as modifiers allowed +// only "" and "inout" are allowed as modifiers module dstress.nocompile.foreach_17; int main(){ - char[] string + char[] string; foreach(in char c; string){ }
--- a/nocompile/foreach_18.d Thu Dec 09 03:26:52 2004 +0000 +++ b/nocompile/foreach_18.d Thu Dec 09 06:08:48 2004 +0000 @@ -2,12 +2,12 @@ // $Date$ // $Author$ -// onyl "" and "inout" are as modifiers allowed +// only "" and "inout" are allowed as modifiers module dstress.nocompile.foreach_18; int main(){ - char[] string + char[] string; foreach(out char c; string){ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/foreach_19.d Thu Dec 09 06:08:48 2004 +0000 @@ -0,0 +1,15 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// index has to be int / uint + +module dstress.nocompile.foreach_19; + +int main(){ + char[] string; + foreach(byte index, char c; string){ + + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/foreach_20.d Thu Dec 09 06:08:48 2004 +0000 @@ -0,0 +1,15 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// index has to be int / uint + +module dstress.nocompile.foreach_20; + +int main(){ + char[] string; + foreach(dchar index, char c; string){ + + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/foreach_21.d Thu Dec 09 06:08:48 2004 +0000 @@ -0,0 +1,12 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.nocompile.foreach_21; + +int main(){ + char[] string; + foreach(int c, char c; string){ + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/foreach_22.d Thu Dec 09 06:08:48 2004 +0000 @@ -0,0 +1,12 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.nocompile.foreach_22; + +int main(){ + int[] array; + foreach(int c, int c; array){ + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/foreach_23.d Thu Dec 09 06:08:48 2004 +0000 @@ -0,0 +1,15 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.foreach_23; + +int main(){ + int[] array; + array.length = 6; + foreach(size_t i, int c; array){ + array[0]+=i; + } + assert(array[0]==15); + return 0; +}