فهرست منبع

2003-12-16 Atsushi Enomoto <[email protected]>

	* XmlDeclarationTests.cs : Added InvalidInnerText().
	* XmlDocumentTests.cs : CRLF fix (to LF)
	* XmlWriterTests.cs : tiny fix on WriteNodeFullDocument().
	* XmlValidatingReaderTests.cs : Fixed entity handling check tests.

svn path=/trunk/mcs/; revision=21243
Atsushi Eno 22 سال پیش
والد
کامیت
b95124c7fb

+ 7 - 0
mcs/class/System.XML/Test/System.Xml/ChangeLog

@@ -1,3 +1,10 @@
+2003-12-16  Atsushi Enomoto <[email protected]>
+
+	* XmlDeclarationTests.cs : Added InvalidInnerText().
+	* XmlDocumentTests.cs : CRLF fix (to LF)
+	* XmlWriterTests.cs : tiny fix on WriteNodeFullDocument().
+	* XmlValidatingReaderTests.cs : Fixed entity handling check tests.
+
 2003-11-28  Atsushi Enomoto <[email protected]>
 
 	* XmlWriterTests.cs : Added WriteNodeFullDocument() with 

+ 7 - 0
mcs/class/System.XML/Test/System.Xml/XmlDeclarationTests.cs

@@ -97,6 +97,13 @@ namespace MonoTests.System.Xml
 			AssertEquals ("null Encoding property", String.Empty, d2.Encoding);
 		}
 
+		[Test]
+		[ExpectedException (typeof (XmlException))]
+		public void InvalidInnerText ()
+		{
+			declaration.InnerText = "version='1.0a'";
+		}
+
 		[Test]
 		public void StandaloneProperty ()
 		{

+ 19 - 19
mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs

@@ -961,24 +961,24 @@ namespace MonoTests.System.Xml
 //			document.Load ("xmlfiles/test.xml");
 //		}
 
-		[Test]
-		[ExpectedException (typeof (XmlException))]
-		public void LoadThrowsUndeclaredEntity ()
-		{
-			string ent1 = "<!ENTITY ent 'entity string'>";
-			string ent2 = "<!ENTITY ent2 '<foo/><foo/>'>]>";
-			string dtd = "<!DOCTYPE root[<!ELEMENT root (#PCDATA|foo)*>" + ent1 + ent2;
-			string xml = dtd + "<root>&ent3;&ent2;</root>";
-			XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
-			document.Load (xtr);
-		}
-
-		[Test]
-		public void ResolveEntityWithoutDTD ()
-		{
-			document.RemoveAll ();
-			document.AppendChild (document.CreateElement ("root"));
-			document.DocumentElement.AppendChild (document.CreateEntityReference ("foo"));
-		}
+		[Test]
+		[ExpectedException (typeof (XmlException))]
+		public void LoadThrowsUndeclaredEntity ()
+		{
+			string ent1 = "<!ENTITY ent 'entity string'>";
+			string ent2 = "<!ENTITY ent2 '<foo/><foo/>'>]>";
+			string dtd = "<!DOCTYPE root[<!ELEMENT root (#PCDATA|foo)*>" + ent1 + ent2;
+			string xml = dtd + "<root>&ent3;&ent2;</root>";
+			XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+			document.Load (xtr);
+		}
+
+		[Test]
+		public void CreateEntityReferencesWithoutDTD ()
+		{
+			document.RemoveAll ();
+			document.AppendChild (document.CreateElement ("root"));
+			document.DocumentElement.AppendChild (document.CreateEntityReference ("foo"));
+		}
 	}
 }

+ 7 - 7
mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs

@@ -20,7 +20,6 @@ namespace MonoTests.System.Xml
 		{
 		}
 
-		XmlReader xtr;
 		XmlValidatingReader dvr;
 
 		private XmlValidatingReader PrepareXmlReader (string xml)
@@ -303,7 +302,7 @@ namespace MonoTests.System.Xml
 			try {
 				dvr.Read ();	// missing attributes
 				Fail ("should be failed.");
-			} catch (XmlSchemaException ex) {
+			} catch (XmlSchemaException) {
 			}
 
 			// empty element but attributes are required
@@ -316,7 +315,7 @@ namespace MonoTests.System.Xml
 			try {
 				dvr.Read ();	// missing attributes
 				Fail ("should be failed.");
-			} catch (XmlSchemaException ex) {
+			} catch (XmlSchemaException) {
 			}
 
 			xml = dtd + "<root foo='value' />";
@@ -440,7 +439,8 @@ namespace MonoTests.System.Xml
 			AssertEquals ("root", dvr.Name);
 			Assert (dvr.MoveToFirstAttribute ());
 			AssertEquals ("foo", dvr.Name);
-			AssertEquals ("entity string", dvr.Value);
+			// MS BUG: it returns "entity string", however, entity should not be exanded.
+			AssertEquals ("&ent;", dvr.Value);
 			//  ReadAttributeValue()
 			Assert (dvr.ReadAttributeValue ());
 			AssertEquals (XmlNodeType.EntityReference, dvr.NodeType);
@@ -451,7 +451,7 @@ namespace MonoTests.System.Xml
 			// bar
 			Assert (dvr.MoveToNextAttribute ());
 			AssertEquals ("bar", dvr.Name);
-			AssertEquals ("internal entity string value", dvr.Value);
+			AssertEquals ("internal &ent; value", dvr.Value);
 			//  ReadAttributeValue()
 			Assert (dvr.ReadAttributeValue ());
 			AssertEquals (XmlNodeType.Text, dvr.NodeType);
@@ -479,7 +479,7 @@ namespace MonoTests.System.Xml
 			// foo
 			Assert (dvr.MoveToFirstAttribute ());
 			AssertEquals ("foo", dvr.Name);
-			AssertEquals ("entity string", dvr.Value);
+			AssertEquals ("&ent;", dvr.Value);
 			//  ReadAttributeValue()
 			Assert (dvr.ReadAttributeValue ());
 			AssertEquals (XmlNodeType.EntityReference, dvr.NodeType);
@@ -490,7 +490,7 @@ namespace MonoTests.System.Xml
 			// bar
 			Assert (dvr.MoveToNextAttribute ());
 			AssertEquals ("bar", dvr.Name);
-			AssertEquals ("internal entity string value", dvr.Value);
+			AssertEquals ("internal &ent; value", dvr.Value);
 			//  ReadAttributeValue()
 			Assert (dvr.ReadAttributeValue ());
 			AssertEquals (XmlNodeType.Text, dvr.NodeType);

+ 1 - 1
mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs

@@ -50,7 +50,7 @@ namespace MonoTests.System.Xml
 
 			// With encoding
 			setupWriter ();
-			xml = "<?xml version='1.0' encoding='iso-2022-jp' ?><root />";
+			xml = "<?xml version='1.0' encoding='iso-2022-jp'?><root />";
 			xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
 			xtw.WriteNode (xtr, false);
 			AssertEquals (xml, writer.ToString ());