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:
Diffstat (limited to 'mcs/class/System.XML/Test')
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog14
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs84
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs27
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs101
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog14
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs40
-rw-r--r--mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog4
-rw-r--r--mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd11
8 files changed, 27 insertions, 268 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
index 2f486b9cb16..b40a0c2b464 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
@@ -1,17 +1,3 @@
-2006-01-10 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlSchemaTypeTests.cs : new file. Test for TypeCode.
- * XmlSchemaSetTests.cs : added more tests for Add() and marked one as
- NotWorking (we need info on how consistent this method is).
-
-2006-01-10 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlSchemaDatatypeTests.cs : oops sys.col.generic is NET_2_0.
-
-2006-01-10 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlSchemaDatatypeTests.cs : added test for 2.0 IsDerivedFrom().
-
2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaSetTests.cs : added AddRollbackIsCompiled(); Add() changes
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
index e7420bf4a67..a0d23a0ea61 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
@@ -11,16 +11,8 @@ using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
using NUnit.Framework;
-using QName = System.Xml.XmlQualifiedName;
-using SimpleType = System.Xml.Schema.XmlSchemaSimpleType;
-using SimpleRest = System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
-using AssertType = NUnit.Framework.Assert;
-
namespace MonoTests.System.Xml
{
[TestFixture]
@@ -47,7 +39,6 @@ namespace MonoTests.System.Xml
}
[Test]
- [Category ("NotWorking")] // ContentTypeParticle impl. difference.
public void TestAnyType ()
{
XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/datatypesTest.xsd");
@@ -80,80 +71,5 @@ namespace MonoTests.System.Xml
// AssertDatatype (schema, 6, XmlTokenizedType.NMTOKEN, typeof (string []), "f o o", new string [] {"f", "o", "o"});
}
-#if NET_2_0
- string [] allTypes = new string [] {
- "string", "boolean", "float", "double", "decimal",
- "duration", "dateTime", "time", "date", "gYearMonth",
- "gYear", "gMonthDay", "gDay", "gMonth", "hexBinary",
- "base64Binary", "anyURI", "QName", "NOTATION",
- "normalizedString", "token", "language", "IDREFS",
- "ENTITIES", "NMTOKEN", "NMTOKENS", "Name", "NCName",
- "ID", "IDREF", "ENTITY", "integer",
- "nonPositiveInteger", "negativeInteger", "long",
- "int", "short", "byte", "nonNegativeInteger",
- "unsignedLong", "unsignedInt", "unsignedShort",
- "unsignedByte", "positiveInteger"
- };
-
- XmlSchemaSet allWrappers;
-
- void SetupSimpleTypeWrappers ()
- {
- XmlSchema schema = new XmlSchema ();
- List<QName> qnames = new List<QName> ();
- foreach (string name in allTypes) {
- SimpleType st = new SimpleType ();
- st.Name = "x-" + name;
- SimpleRest r = new SimpleRest ();
- st.Content = r;
- QName qname = new QName (name, XmlSchema.Namespace);
- r.BaseTypeName = qname;
- qnames.Add (qname);
- schema.Items.Add (st);
- }
- XmlSchemaSet sset = new XmlSchemaSet ();
- sset.Add (schema);
- sset.Compile ();
- allWrappers = sset;
- }
-
- XmlSchemaDatatype GetDatatype (string name)
- {
- return (allWrappers.GlobalTypes [new QName ("x-" + name,
- String.Empty)] as SimpleType).Datatype;
- }
-
- string [] GetDerived (string target)
- {
- XmlSchemaDatatype strType = GetDatatype (target);
- List<string> results = new List<string> ();
- foreach (string name in allTypes) {
- if (name == target)
- continue;
- XmlSchemaDatatype deriv = GetDatatype (name);
- if (deriv.IsDerivedFrom (strType))
- results.Add (name);
- else Console.Error.WriteLine (deriv.GetType () + " is not derived from " + strType.GetType ());
- }
- return results.ToArray ();
- }
-
- [Test]
- public void IsDerivedFrom ()
- {
- SetupSimpleTypeWrappers ();
-
- // Funky, but XmlSchemaDatatype.IsDerivedFrom() is
- // documented to always return false, but actually
- // matches the same type - which could be guessed that
- // this method is used only to detect user-defined
- // simpleType derivation.
- foreach (string b in allTypes)
- foreach (string d in allTypes)
- AssertType.AreEqual (b == d, GetDatatype (d).IsDerivedFrom (GetDatatype (b)), b);
-
- AssertType.IsFalse (GetDatatype ("string").IsDerivedFrom (null), "null arg");
- }
-#endif
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
index 20ad97f68b2..56a066c6760 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
@@ -56,22 +56,9 @@ namespace MonoTests.System.Xml
}
[Test]
- public void AddSchemaThenReader ()
- {
- XmlSchemaSet ss = new XmlSchemaSet ();
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' />");
- XmlSchema xs = new XmlSchema ();
- xs.TargetNamespace = "ab";
- ss.Add (xs);
- ss.Add ("ab", new XmlNodeReader (doc));
- }
-
- [Test]
- [Category ("NotWorking")] // How can we differentiate this
- // case and the testcase above?
+ [Ignore ("This behavior might be changed, since Add(XmlSchema) does not throw any exceptions, while this does.")]
[ExpectedException (typeof (ArgumentException))]
- public void AddReaderTwice ()
+ public void AddTwice ()
{
XmlSchemaSet ss = new XmlSchemaSet ();
XmlDocument doc = new XmlDocument ();
@@ -81,16 +68,6 @@ namespace MonoTests.System.Xml
}
[Test]
- public void AddSchemaTwice ()
- {
- XmlSchemaSet ss = new XmlSchemaSet ();
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:ab' />");
- ss.Add (XmlSchema.Read (new XmlNodeReader (doc), null));
- ss.Add (XmlSchema.Read (new XmlNodeReader (doc), null));
- }
-
- [Test]
public void CompilationSettings ()
{
Assert.IsNotNull (new XmlSchemaSet ().CompilationSettings);
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
deleted file mode 100644
index f97b6bddc44..00000000000
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// System.Xml.XmlSchemaSetTests.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// (C) 2004 Novell Inc.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Xml;
-using System.Xml.Schema;
-using NUnit.Framework;
-
-using QName = System.Xml.XmlQualifiedName;
-using SimpleType = System.Xml.Schema.XmlSchemaSimpleType;
-using SimpleRest = System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
-using AssertType = NUnit.Framework.Assert;
-
-namespace MonoTests.System.Xml
-{
- [TestFixture]
- public class XmlSchemaTypeTests
- {
-#if NET_2_0
- string [] all_types = new string [] {
- "string", "boolean", "float", "double", "decimal",
- "duration", "dateTime", "time", "date", "gYearMonth",
- "gYear", "gMonthDay", "gDay", "gMonth", "hexBinary",
- "base64Binary", "anyURI", "QName", "NOTATION",
- "normalizedString", "token", "language", "IDREFS",
- "ENTITIES", "NMTOKEN", "NMTOKENS", "Name", "NCName",
- "ID", "IDREF", "ENTITY", "integer",
- "nonPositiveInteger", "negativeInteger", "long",
- "int", "short", "byte", "nonNegativeInteger",
- "unsignedLong", "unsignedInt", "unsignedShort",
- "unsignedByte", "positiveInteger"
- };
-
- XmlTypeCode [] type_codes = new XmlTypeCode [] {
- XmlTypeCode.String,
- XmlTypeCode.Boolean,
- XmlTypeCode.Float,
- XmlTypeCode.Double,
- XmlTypeCode.Decimal,
- XmlTypeCode.Duration,
- XmlTypeCode.DateTime,
- XmlTypeCode.Time,
- XmlTypeCode.Date,
- XmlTypeCode.GYearMonth,
- XmlTypeCode.GYear,
- XmlTypeCode.GMonthDay,
- XmlTypeCode.GDay,
- XmlTypeCode.GMonth,
- XmlTypeCode.HexBinary,
- XmlTypeCode.Base64Binary,
- XmlTypeCode.AnyUri,
- XmlTypeCode.QName,
- XmlTypeCode.Notation,
- XmlTypeCode.NormalizedString,
- XmlTypeCode.Token,
- XmlTypeCode.Language,
- XmlTypeCode.Idref, // IDREFS (LAMESPEC)
- XmlTypeCode.Entity, // ENTITIES (LAMESPEC)
- XmlTypeCode.NmToken,
- XmlTypeCode.NmToken, // NMTOKENS (LAMESPEC)
- XmlTypeCode.Name,
- XmlTypeCode.NCName,
- XmlTypeCode.Id,
- XmlTypeCode.Idref,
- XmlTypeCode.Entity,
- XmlTypeCode.Integer,
- XmlTypeCode.NonPositiveInteger,
- XmlTypeCode.NegativeInteger,
- XmlTypeCode.Long,
- XmlTypeCode.Int,
- XmlTypeCode.Short,
- XmlTypeCode.Byte,
- XmlTypeCode.NonNegativeInteger,
- XmlTypeCode.UnsignedLong,
- XmlTypeCode.UnsignedInt,
- XmlTypeCode.UnsignedShort,
- XmlTypeCode.UnsignedByte,
- XmlTypeCode.PositiveInteger};
-
- [Test]
- public void TypeCode ()
- {
- for (int i = 0; i < all_types.Length; i++) {
- string name = all_types [i];
- QName qname = new QName (name, XmlSchema.Namespace);
- Assert.AreEqual (type_codes [i],
- XmlSchemaType.GetBuiltInSimpleType (qname).TypeCode, name);
- }
- }
-
-#endif
- }
-}
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 2e69a65947e..441ca9c9bfa 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,17 +1,3 @@
-2006-01-12 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlTextWriterTests.cs : Split AutoCreatePrefixes() and marked as
- Ignore rather than NotWorking. Also it is not for bug #77086 and
- #77077 (they were fixed). See bug #77088.
-
-2006-01-12 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlTextWriterTests.cs : re-enabled WriteNmToken_InvalidChars().
-
-2006-01-12 Atsushi Enomoto <atsushi@ximian.com>
-
- * XmlTextWriterTests.cs : re-enabled bug #77094 related tests.
-
2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
* XmlWriterTests.cs : added tests for WriteNode(XPathNavigator, bool)
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
index b70e2cce2a1..90661afd68c 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
@@ -205,26 +205,29 @@ namespace MonoTests.System.Xml
}
[Test]
- [Ignore ("Due to the (silly) dependency on bug #77088, this test will not be fixed. The test could be rewritten but it depends on the original test author.")]
+ [Category ("NotWorking")] // bug #77086, #77087 and #77088
public void AutoCreatePrefixes ()
{
- xtw.WriteStartElement ("root");
xtw.WriteAttributeString (null, "abc", "http://somenamespace.com", "http://abc.def");
xtw.WriteAttributeString (null, "def", "http://somenamespace.com", "http://def.ghi");
xtw.WriteAttributeString (null, "ghi", "http://othernamespace.com", "http://ghi.jkl");
- xtw.WriteEndElement ();
- Assert.AreEqual ("<root d1p1:abc='http://abc.def' d1p1:def='http://def.ghi' d1p2:ghi='http://ghi.jkl' xmlns:d1p2='http://othernamespace.com' xmlns:d1p1='http://somenamespace.com' />", StringWriterText, "#1");
- }
+#if NET_2_0
+ Assert.AreEqual ("d0p1:abc='http://abc.def' d0p1:def='http://def.ghi'" +
+ " d0p2:ghi='http://ghi.jkl'", StringWriterText, "#1");
+#else
+ // on 1.x a new prefix is always created when level is 0 ?
+ Assert.AreEqual ("d0p1:abc='http://abc.def' d0p2:def='http://def.ghi'" +
+ " d0p3:ghi='http://ghi.jkl'", StringWriterText, "#1");
+#endif
+
+ sw.GetStringBuilder ().Length = 0;
+ CreateXmlTextWriter ();
- [Test]
- [Ignore ("Due to the (silly) dependency on bug #77088, this test will not be fixed. The test could be rewritten but it depends on the original test author.")]
- public void AutoCreatePrefixes2 ()
- {
xtw.WriteStartElement ("person");
- xtw.WriteAttributeString (null, "name", "http://somenamespace.com", "Driesen");
- xtw.WriteAttributeString (null, "initials", "http://othernamespace.com", "GD");
- xtw.WriteAttributeString (null, "firstName", "http://somenamespace.com", "Gert");
+ xtw.WriteAttributeString (null, "name", "http://somenamespace.com", "Gates");
+ xtw.WriteAttributeString (null, "initials", "http://othernamespace.com", "BG");
+ xtw.WriteAttributeString (null, "firstName", "http://somenamespace.com", "Bill");
xtw.WriteStartElement ("address");
xtw.WriteAttributeString (null, "street", "http://somenamespace.com", "Campus");
xtw.WriteAttributeString (null, "number", "http://othernamespace.com", "1");
@@ -235,9 +238,9 @@ namespace MonoTests.System.Xml
Assert.AreEqual (
"<person" +
- " d1p1:name='Driesen'" +
- " d1p2:initials='GD'" +
- " d1p1:firstName='Gert'" +
+ " d1p1:name='Gates'" +
+ " d1p2:initials='BG'" +
+ " d1p1:firstName='Bill'" +
" xmlns:d1p2='http://othernamespace.com'" +
" xmlns:d1p1='http://somenamespace.com'>" +
"<address" +
@@ -522,8 +525,12 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("NotWorking")]
public void WriteStartElement_XmlPrefix ()
{
+ // uncomment the next code block once bug #77094 has been fixed.
+
+ /*
xtw.WriteStartElement ("xml", "something", "http://www.w3.org/XML/1998/namespace");
Assert.AreEqual ("<xml:something", StringWriterText, "#1");
@@ -541,6 +548,7 @@ namespace MonoTests.System.Xml
sw.GetStringBuilder ().Length = 0;
CreateXmlTextWriter ();
+ */
}
[Test]
@@ -551,6 +559,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("NotWorking")] // bug #77094
[ExpectedException (typeof (ArgumentException))]
public void WriteStartElement_XmlPrefix_Invalid2 ()
{
@@ -1527,6 +1536,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("NotWorking")] // on mono, an XmlException is thrown instead
[ExpectedException (typeof (ArgumentException))]
public void WriteNmToken_InvalidChars ()
{
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog b/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
index a645e2bff91..3fa61cb1cd3 100644
--- a/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
@@ -1,7 +1,3 @@
-2006-01-11 Atsushi Enomoto <atsushi@ximian.com>
-
- * datatypesTest.xsd : missing required file for xsd tests.
-
2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
* multi-schemaLocation.xml,
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
deleted file mode 100644
index 50fb15c3740..00000000000
--- a/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
+++ /dev/null
@@ -1,11 +0,0 @@
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns="urn:bar" targetNamespace="urn:bar">
- <xs:element name="e00">
- <xs:complexType>
- </xs:complexType>
- </xs:element>
- <xs:element name="e4" type="xs:string" />
- <xs:element name="e1" type="xs:normalizedString" />
- <xs:element name="e2" type="xs:token" />
- <xs:element name="e3" type="xs:language" />
-</xs:schema>