Author: atsushi
Date: 2006-01-19 04:47:00 -0500 (Thu, 19 Jan 2006)
New Revision: 55774
Modified:
trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
trunk/mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
Log:
2006-01-19 Atsushi Enomoto <[EMAIL PROTECTED]>
* DictionaryTest.cs : fixed several tests to not fail under .NET 2.0
and thus marked some as NotWorking. Numbered some assertions.
Modified: trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
2006-01-19 09:45:51 UTC (rev 55773)
+++ trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
2006-01-19 09:47:00 UTC (rev 55774)
@@ -1,3 +1,8 @@
+2006-01-19 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * DictionaryTest.cs : fixed several tests to not fail under .NET 2.0
+ and thus marked some as NotWorking. Numbered some assertions.
+
2005-12-21 Sebastien Pouliot <[EMAIL PROTECTED]>
* ListTest.cs: Added test cases for #77039 for sorting a list with
Modified:
trunk/mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
2006-01-19 09:45:51 UTC (rev 55773)
+++ trunk/mcs/class/corlib/Test/System.Collections.Generic/DictionaryTest.cs
2006-01-19 09:47:00 UTC (rev 55774)
@@ -332,6 +332,7 @@
}
[Test]
+ [Category ("NotWorking")] // our code is based on 2.0 beta.
public void IEnumeratorTest ()
{
_dictionary.Add ("key1", "value1");
@@ -341,10 +342,8 @@
IEnumerator itr =
((IEnumerable)_dictionary).GetEnumerator ();
while (itr.MoveNext ()) {
object o = itr.Current;
- Assert.AreEqual (typeof (DictionaryEntry),
o.GetType (), "Current should return a type of DictionaryEntry");
- DictionaryEntry entry =
(DictionaryEntry)itr.Current;
- if (entry.Key.ToString () == "key4")
- entry.Value = "value33";
+ Assert.AreEqual (typeof
(KeyValuePair<string,object>), o.GetType (), "Current should return a type of
KeyValuePair");
+ KeyValuePair<string,object> entry =
(KeyValuePair<string,object>) itr.Current;
}
Assert.AreEqual ("value4", _dictionary
["key4"].ToString (), "");
}
@@ -360,7 +359,7 @@
IEnumerator <KeyValuePair <string, object>> itr =
((IEnumerable <KeyValuePair <string, object>>)_dictionary).GetEnumerator ();
while (itr.MoveNext ()) {
object o = itr.Current;
- Assert.AreEqual (typeof (KeyValuePair <string,
object>), o.GetType (), "Current should return a type of DictionaryEntry");
+ Assert.AreEqual (typeof (KeyValuePair <string,
object>), o.GetType (), "Current should return a type of
KeyValuePair<object,string>");
KeyValuePair <string, object> entry =
(KeyValuePair <string, object>)itr.Current;
}
Assert.AreEqual ("value4", _dictionary
["key4"].ToString (), "");
@@ -378,15 +377,14 @@
while (itr.MoveNext ()) {
object o = itr.Current;
Assert.AreEqual (typeof (DictionaryEntry),
o.GetType (), "Current should return a type of DictionaryEntry");
- DictionaryEntry entry =
(DictionaryEntry)itr.Current;
- if (entry.Key.ToString () == "key4")
- entry.Value = "value33";
+ DictionaryEntry entry = (DictionaryEntry)
itr.Current;
}
Assert.AreEqual ("value4", _dictionary
["key4"].ToString (), "");
}
[Test]
+ [Category ("NotWorking")] // our code is based on 2.0 beta.
public void ForEachTest ()
{
_dictionary.Add ("key1", "value1");
@@ -402,7 +400,7 @@
Assert.AreEqual(4, i, "fail1: foreach entry failed!");
i = 0;
- foreach (DictionaryEntry entry in
((IEnumerable)_dictionary))
+ foreach (KeyValuePair <string, object> entry in
((IEnumerable)_dictionary))
{
i++;
}
@@ -498,15 +496,16 @@
}
[Test]
+ [Category ("NotWorking")] // our code is based on 2.0 beta.
public void PlainEnumeratorReturnTest ()
{
- // Test that we return a DictionaryEntry for
non-generic dictionary iteration
+ // Test that we return a KeyValuePair even for
non-generic dictionary iteration
_dictionary["foo"] = "bar";
IEnumerator<KeyValuePair<string, object>> enumerator =
_dictionary.GetEnumerator();
- Assert.IsTrue(enumerator.MoveNext());
- Assert.IsTrue(((IEnumerator)enumerator).Current is
DictionaryEntry);
-
Assert.IsTrue(((IDictionaryEnumerator)enumerator).Current is DictionaryEntry);
- Assert.IsFalse(((object) enumerator.Current) is
DictionaryEntry);
+ Assert.IsTrue(enumerator.MoveNext(), "#1");
+ Assert.AreEqual (typeof (KeyValuePair<string,object>),
((IEnumerator)enumerator).Current.GetType (), "#2");
+ Assert.AreEqual (typeof (KeyValuePair<string,object>),
((IDictionaryEnumerator)enumerator).Current.GetType (), "#3");
+ Assert.AreEqual (typeof (KeyValuePair<string,object>),
((object) enumerator.Current).GetType (), "#4");
}
[Test, ExpectedException (typeof (InvalidOperationException))]
@@ -627,7 +626,7 @@
{
Dictionary<int, int> d = new Dictionary<int, int> ();
ICollection c = (ICollection) d;
- DictionaryEntry[] array = new DictionaryEntry[1];
+ DictionaryEntry [] array = new DictionaryEntry [1];
c.CopyTo (array, 0);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches