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/System.Xml/XsdValidatingReaderTests.cs')
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
index 407aabb6a16..3ed1698c6b6 100644
--- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
@@ -261,5 +261,33 @@ namespace MonoTests.System.Xml
AssertEquals ("xx", vr.ReadTypedValue ());
AssertEquals (XmlNodeType.EndElement, vr.NodeType);
}
+
+ // If we normalize string before validating with facets,
+ // this test will fail. It will also fail if ReadTypedValue()
+ // ignores whitespace nodes.
+ [Test]
+ public void ReadTypedValueWhitespaces ()
+ {
+ string xml = "<root> </root><!-- after -->";
+ string xsd = @"
+<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='root'>
+ <xs:simpleType>
+ <xs:restriction base='xs:string'>
+ <xs:minLength value='2' />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+</xs:schema>";
+ XmlTextReader xir =
+ new XmlTextReader (xml, XmlNodeType.Document, null);
+ XmlTextReader xsr =
+ new XmlTextReader (xsd, XmlNodeType.Document, null);
+ XmlValidatingReader vr = new XmlValidatingReader (xir);
+ vr.Schemas.Add (XmlSchema.Read (xsr, null));
+ vr.Read (); // root
+ AssertEquals (" ", vr.ReadTypedValue ());
+ AssertEquals (XmlNodeType.EndElement, vr.NodeType);
+ }
}
}