[Mono-list] (no subject)
David Sheldon
dave-monolist@earth.li
Thu, 28 Nov 2002 12:32:01 +0000
I have been looking at the test cases for System.XML.
Attached is some more tests for the Value property. It appears that the
current code does not manage to parse the encoding correctly, or failes
round-tripping it. Incidently is there a way of getting a list of all of
the failures, without writing a separate program with a different
definition of AssertEquals? I will have a look at the current
declaration parsing, and see if I can work out what is going wrong here.
The other failure is that in the case where there is a \n in the
encoding string, it appears to duplicate the standalone attribute in the
round-trip.
Also, when running the tests, I appear to get about 13 tests marked as
errors with (mainly NullPointer) exceptions. Does anyone else get these
(in which case I will look at fixing them), or is it a peculiarity of my
system (in which case I will see what that is)?
David
Index: XmlDeclarationTests.cs
===================================================================
RCS file: /mono/mcs/class/System.XML/Test/XmlDeclarationTests.cs,v
retrieving revision 1.4
diff -u -r1.4 XmlDeclarationTests.cs
--- XmlDeclarationTests.cs 5 May 2002 10:31:13 -0000 1.4
+++ XmlDeclarationTests.cs 28 Nov 2002 11:45:42 -0000
@@ -108,9 +108,32 @@
public void TestValueProperty ()
{
- XmlDeclaration d = document.CreateXmlDeclaration ("1.0", "UTF-8", "yes");
- AssertEquals ("Value property", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"",
- d.Value);
+ string expected ="version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+
+ XmlDeclaration d = document.CreateXmlDeclaration ("1.0", "ISO-8859-1", "yes");
+ AssertEquals ("Value property", expected, d.Value);
+
+ d.Value = expected;
+ AssertEquals("Value round-trip", expected, d.Value);
+
+ d.Value=" "+ expected;
+ AssertEquals("Value round-trip (padded)", expected, d.Value);
+
+ d.Value ="version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals("Value round-trip (padded 2)", expected, d.Value);
+
+ d.Value ="version=\"1.0\"\tencoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals("Value round-trip (\\t)", expected, d.Value);
+
+ d.Value ="version=\"1.0\"\n encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals("Value round-trip (\\n)", expected, d.Value);
+
+ d.Value ="version=\"1.0\" encoding = \"ISO-8859-1\" standalone = \"yes\"" ;
+ AssertEquals("Value round-trip (spaces)", expected, d.Value);
+
+ d.Value ="version='1.0' encoding='ISO-8859-1' standalone='yes'" ;
+ AssertEquals("Value round-trip ('s)", expected, d.Value);
+
}
public void TestXmlCommentCloneNode ()