diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2010-01-13 12:47:12 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2010-01-13 12:47:12 +0300 |
commit | 5249c143502bda12405551f1aecd069569c8ea27 (patch) | |
tree | 79fe0bc02d612104e9fea7fb207680b2fe63315b /mcs/class/System.XML/Test | |
parent | 3b33f27d09c12880b42a944726faca4d8d4dc066 (diff) |
backport recent bugfixes from trunk.
svn path=/branches/mono-2-6/mcs/; revision=149439
Diffstat (limited to 'mcs/class/System.XML/Test')
-rw-r--r-- | mcs/class/System.XML/Test/System.Xml/ChangeLog | 27 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/System.Xml/XmlConvertTests.cs | 55 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs | 15 |
3 files changed, 93 insertions, 4 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index ad890283509..248d4dad70b 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,6 +1,29 @@ -2009-12-17 Atsushi Enomoto <atsushi@ximian.com> +2010-01-12 Atsushi Enomoto <atsushi@ximian.com> - * XmlTextReaderTests.cs : fix 1.1 build (only 2.6 branch). + * XmlConvertTests.cs : added commented-out tests for the remaining + parse tests by Tiaan Geldenhuys for XLinq, with the reason why. + +2010-01-12 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConvertTests.cs : float parse should do the same. Fix NaN test. + +2010-01-12 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConvertTests.cs : another double parse test for string with + spaces, for string constants such as NaN. + +2010-01-12 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConvertTests.cs : add double parse test for string with spaces. + +2010-01-12 Atsushi Enomoto <atsushi@ximian.com> + + * XmlWriterTests.cs : added a corner case test for empty string handling + difference between XmlTextWriter and XmlWriter.Create(). + +2009-11-17 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConvertTests.cs : add test for DateTimeOffset roundtrip. 2009-11-13 Andreia Gaita <avidigal@novell.com> diff --git a/mcs/class/System.XML/Test/System.Xml/XmlConvertTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlConvertTests.cs index 50b5ab5d73a..2355c558618 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlConvertTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlConvertTests.cs @@ -207,6 +207,12 @@ namespace MonoTests.System.Xml Assert.AreEqual (-1.0d/0.0d, XmlConvert.ToDouble ("-INF")); Assert.AreEqual (0.0d/0.0d, XmlConvert.ToDouble ("NaN")); Assert.AreEqual (789324, XmlConvert.ToDouble ("789324")); + Assert.AreEqual (42, XmlConvert.ToDouble (" 42 ")); + Assert.AreEqual (double.NaN, XmlConvert.ToDouble (" NaN ")); + Assert.AreEqual (double.PositiveInfinity, XmlConvert.ToDouble (" Infinity ")); + Assert.AreEqual (double.NegativeInfinity, XmlConvert.ToDouble (" -Infinity ")); + Assert.AreEqual (double.PositiveInfinity, XmlConvert.ToDouble (" INF")); + Assert.AreEqual (double.NegativeInfinity, XmlConvert.ToDouble (" -INF ")); } [Test] @@ -334,9 +340,18 @@ namespace MonoTests.System.Xml } [Test] - public void ToSingle ()//not done + public void ToSingle () { - + Assert.AreEqual (1.0d/0.0d, XmlConvert.ToSingle ("INF")); + Assert.AreEqual (-1.0d/0.0d, XmlConvert.ToSingle ("-INF")); + Assert.AreEqual (0.0d/0.0d, XmlConvert.ToSingle ("NaN")); + Assert.AreEqual (789324, XmlConvert.ToSingle ("789324")); + Assert.AreEqual (42, XmlConvert.ToSingle (" 42 ")); + Assert.AreEqual (float.NaN, XmlConvert.ToSingle (" NaN ")); + Assert.AreEqual (float.PositiveInfinity, XmlConvert.ToSingle (" Infinity ")); + Assert.AreEqual (float.NegativeInfinity, XmlConvert.ToSingle (" -Infinity ")); + Assert.AreEqual (float.PositiveInfinity, XmlConvert.ToSingle (" INF")); + Assert.AreEqual (float.NegativeInfinity, XmlConvert.ToSingle (" -INF ")); } [Test] @@ -402,6 +417,16 @@ namespace MonoTests.System.Xml Assert.Fail ("0x10000"); } catch (FormatException) { } + // LAMESPEC: it is not fixable as there is no public + // member of UInt16 that treats this as FormatException + // while others above as either OverflowException or + // FormatException respectively. + // (.NET uses internal member in UInt16 here); + //try { + // XmlConvert.ToUInt16 ("-101"); + // Assert.Fail ("-101"); + //} catch (FormatException) { + //} } [Test] @@ -430,6 +455,16 @@ namespace MonoTests.System.Xml Assert.Fail ("0x10000"); } catch (FormatException) { } + // LAMESPEC: it is not fixable as there is no public + // member of UInt32 that treats this as FormatException + // while others above as either OverflowException or + // FormatException respectively. + // (.NET uses internal member in UInt32 here); + //try { + // XmlConvert.ToUInt32 ("-101"); + // Assert.Fail ("-101"); + //} catch (FormatException) { + //} } [Test] @@ -458,6 +493,16 @@ namespace MonoTests.System.Xml Assert.Fail ("0x10000"); } catch (FormatException) { } + // LAMESPEC: it is not fixable as there is no public + // member of UInt64 that treats this as FormatException + // while others above as either OverflowException or + // FormatException respectively. + // (.NET uses internal member in UInt64 here); + //try { + // XmlConvert.ToUInt64 ("-101"); + // Assert.Fail ("-101"); + //} catch (FormatException) { + //} } [Test] @@ -687,6 +732,12 @@ namespace MonoTests.System.Xml } catch (FormatException) { } } + + [Test] // see http://smdn.invisiblefulmoon.net/misc/forum/programming/#n10 + public void DateTimeOffsetTimezoneRoundtrip () + { + Assert.AreEqual (new DateTimeOffset (2009, 11, 05, 20, 16, 22, TimeSpan.FromHours (9)), XmlConvert.ToDateTimeOffset ("2009-11-05T20:16:22+09:00"), "#1"); + } #endif } } diff --git a/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs index df575dcbd05..2b3885d4187 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs @@ -559,6 +559,21 @@ namespace MonoTests.System.Xml w.Close ();
AssertType.AreEqual ("<hoge />", sw.ToString ());
}
+
+ [Test]
+ public void WriteStringDifferentBehavior ()
+ {
+ // Messy implementation difference.
+ // from XmlTextWriter -> <foo />
+ // from XmlWriter.XCreate() -> <foo></foo>
+ var sw = new StringWriter ();
+ var xw = XmlWriter.Create (sw);
+ xw.WriteStartElement ("foo");
+ xw.WriteString ("");
+ xw.WriteEndElement ();
+ xw.Close ();
+ AssertType.AreEqual ("<?xml version='1.0' encoding='utf-16'?><foo></foo>".Replace ('\'', '"'), sw.ToString ());
+ }
#endif
}
|