diff options
author | Miguel de Icaza <miguel@gnome.org> | 2001-11-07 16:33:25 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2001-11-07 16:33:25 +0300 |
commit | 1e97a8e1d0bd68a5b31a73ab31d778d7e68b53e3 (patch) | |
tree | ba2a1b00bf6a5c01824d932a4ee65f5ba3457043 /mcs/tests/test-36.cs | |
parent | 56a952eb348f4588a7b552a07a2355a67a66b5d1 (diff) |
Add a new test that we fail to pass
svn path=/trunk/mcs/; revision=1281
Diffstat (limited to 'mcs/tests/test-36.cs')
-rwxr-xr-x | mcs/tests/test-36.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mcs/tests/test-36.cs b/mcs/tests/test-36.cs new file mode 100755 index 00000000000..11f52732edc --- /dev/null +++ b/mcs/tests/test-36.cs @@ -0,0 +1,35 @@ +// +// This program excercises invoking foreach on structures +// that implement GetEnumerator +// + +using System; +using System.Collections; +struct X { + int [] a; + + public IEnumerator GetEnumerator () + { + a = new int [3] { 1, 2, 3}; + return a.GetEnumerator (); + } + } + +class Y { + static X x; + + static int Main () + { + int total = 0; + x = new X (); + + foreach (object a in x){ + total += (int) a; + } + + if (total != 6) + return 1; + return 0; + } +} + |