Author: martin
Date: 2005-07-08 12:43:41 -0400 (Fri, 08 Jul 2005)
New Revision: 47111
Added:
trunk/mcs/tests/test-iter-10.cs
Log:
New test.
Added: trunk/mcs/tests/test-iter-10.cs
===================================================================
--- trunk/mcs/tests/test-iter-10.cs 2005-07-08 16:24:33 UTC (rev 47110)
+++ trunk/mcs/tests/test-iter-10.cs 2005-07-08 16:43:41 UTC (rev 47111)
@@ -0,0 +1,53 @@
+using System;
+using System.Collections;
+
+class X {
+ static IEnumerator GetIt
+ {
+ get {
+ yield return 1;
+ yield return 2;
+ yield return 3;
+ }
+ set
+ {
+ }
+ }
+
+ IEnumerable this [int i]
+ {
+ get {
+ yield return 1*i;
+ yield return 2*i;
+ yield return 3*i;
+ }
+ set
+ {
+ }
+ }
+
+ static int Main ()
+ {
+ IEnumerator e = GetIt;
+ int total = 0;
+
+ while (e.MoveNext ()){
+ Console.WriteLine ("Value=" + e.Current);
+ total += (int) e.Current;
+ }
+
+ if (total != 6)
+ return 1;
+
+ total = 0;
+ X x = new X ();
+ foreach (int i in x [2]){
+ Console.WriteLine ("Value=" + i);
+ total += i;
+ }
+ if (total != 12)
+ return 2;
+
+ return 0;
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches