2005-05-09 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 9 May 2005 09:21:17 +0000 (09:21 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 9 May 2005 09:21:17 +0000 (09:21 -0000)
* Stack.cs : empty_stack.CopyTo(empty_array, 0) should be allowed.

* StackTest.cs : test for CopyTo() on an empty stack.

svn path=/trunk/mcs/; revision=44253

mcs/class/corlib/System.Collections/ChangeLog
mcs/class/corlib/System.Collections/Stack.cs
mcs/class/corlib/Test/System.Collections/ChangeLog
mcs/class/corlib/Test/System.Collections/StackTest.cs

index eb8363ad03d57129528bb9f95b7cb05e9a5a742c..c44a355541fd8e0e8b86cc804e2ef866bebc7c94 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-09  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Stack.cs : empty_stack.CopyTo(empty_array, 0) should be allowed.
+
 2005-02-21  Zoltan Varga  <vargaz@freemail.hu>
 
        * Hashtable.cs: Add net 2.0 ReliabilityContractAttributes.
index 48c0eafbb4069c00fb2cf717d146f65fe762d38f..5cb4a167e3d16e4f05225cc987f75cbb87c07bcf 100644 (file)
@@ -222,7 +222,7 @@ namespace System.Collections {
                        }\r
 \r
                        if (array.Rank > 1 || \r
-                           index >= array.Length || \r
+                           array.Length > 0 && index >= array.Length || \r
                            count > array.Length - index) {\r
                                throw new ArgumentException();\r
                        }\r
index 0cbfe262ac0f2e1f6635abc7f61689bcc2340d47..1fe3869925657465a596878bc524ee33a70825d2 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-09  Atsushi Enomoto  <atsushi@ximian.com>\r
+\r
+       * StackTest.cs : test for CopyTo() on an empty stack.\r
+\r
 2005-01-05  Nick Drochak  <ndrochak@ieee.org>\r
 \r
        * ComparerTest.cs: Modernize and fix line endings. Test is failing with\r
index 88f8b221ed749e73eb879acead299bacfc27052e..35137eae9f2ae410c6a01b02b8d67c1bb63405f1 100644 (file)
@@ -369,6 +369,13 @@ namespace MonoTests.System.Collections
                        }
                }
 
+               public void TestEmptyCopyTo ()
+               {
+                       Stack stack = new Stack ();
+                       string [] arr = new string [0];
+                       stack.CopyTo (arr, 0);
+               }
+
                [SetUp]
                 protected  void SetUp()
                 {