Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2001-11-07 16:33:25 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-11-07 16:33:25 +0300
commit1e97a8e1d0bd68a5b31a73ab31d778d7e68b53e3 (patch)
treeba2a1b00bf6a5c01824d932a4ee65f5ba3457043 /mcs/tests/test-36.cs
parent56a952eb348f4588a7b552a07a2355a67a66b5d1 (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-xmcs/tests/test-36.cs35
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;
+ }
+}
+