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:
authorSebastien Pouliot <sebastien@xamarin.com>2013-03-19 01:38:01 +0400
committerSebastien Pouliot <sebastien@xamarin.com>2013-03-19 01:38:28 +0400
commitc3b782f4ecdaf1e2aaaf271cdb994fbd82190e51 (patch)
tree0dbfe8f613afe1ab705f8227791f83d192282097 /mcs/class/System.XML
parentd168c95182f2619670428ccc78674d1235fb9cc9 (diff)
Do not assume the unit tests can write in the application directory (e.g. iOS devices). Use the temporary directory and open files in read-only
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs2
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs5
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs21
5 files changed, 21 insertions, 16 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
index 779c8bd1e1e..8ae833f9dcc 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
@@ -586,7 +586,7 @@ namespace MonoTests.System.Xml
public void TestResolveUri ()
{
XmlSchemaSet schemaSet = new XmlSchemaSet ();
- FileStream stream = new FileStream ("Test/XmlFiles/xsd/resolveUriSchema.xsd", FileMode.Open);
+ FileStream stream = new FileStream ("Test/XmlFiles/xsd/resolveUriSchema.xsd", FileMode.Open, FileAccess.Read);
schemaSet.Add ("http://tempuri.org/resolveUriSchema.xsd", new XmlTextReader (stream));
XmlTestResolver resolver = new XmlTestResolver ();
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
index 751242425cc..9e1c9f2b52e 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
@@ -1639,18 +1639,19 @@ namespace MonoTests.System.XmlSerialization
[Test]
public void Bug708178Type()
{
+ string file = Path.Combine (Path.GetTempPath (), "Bug708178Type.xml");
XmlSerializer xmlSerializer = new XmlSerializer (typeof(Bug708178Type));
Bug708178Type bugType = new Bug708178Type ();
bugType.Foo.Add ("test");
Assert.AreEqual (1, bugType.Foo.Count);
//xml Serialize
- TextWriter WriteFileStream = new StreamWriter (@"Bug708178Type.xml", false);
+ TextWriter WriteFileStream = new StreamWriter (file, false);
xmlSerializer.Serialize (WriteFileStream, bugType);
WriteFileStream.Close ();
//xml Deserialize
- FileStream ReadFileStream = new FileStream (@"Bug708178Type.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
+ FileStream ReadFileStream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read);
Bug708178Type bugTypeReload = (Bug708178Type)xmlSerializer.Deserialize (ReadFileStream);
//should have deserialized the relationship
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
index 18cef9df486..b276342806c 100644
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
@@ -36,10 +36,11 @@ namespace MonoTests.System.Xml.Xsl
[Test]
public void TestBasicTransform ()
{
+ string output = Path.Combine (Path.GetTempPath (), "result.xml");
doc.LoadXml ("<root/>");
xslt.Load ("Test/XmlFiles/xsl/empty.xsl");
- xslt.Transform ("Test/XmlFiles/xsl/empty.xsl", "Test/XmlFiles/xsl/result.xml");
- result.Load ("Test/XmlFiles/xsl/result.xml");
+ xslt.Transform ("Test/XmlFiles/xsl/empty.xsl", output);
+ result.Load (output);
Assert.AreEqual (2, result.ChildNodes.Count, "count");
}
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
index 8f522a85e56..749e601abda 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
@@ -1540,7 +1540,7 @@ namespace MonoTests.System.Xml
// a bit revised version of bug #78706
public void CreateFromUrlClose ()
{
- string file = "Test/XmlFiles/78706.xml";
+ string file = Path.Combine (Path.GetTempPath (), "78706.xml");
try {
if (!File.Exists (file))
File.Create (file).Close ();
@@ -1560,7 +1560,7 @@ namespace MonoTests.System.Xml
// a bit revised version of bug #385638
public void CreateFromUrlClose2 ()
{
- string file = "Test/XmlFiles/385638.xml";
+ string file = Path.Combine (Path.GetTempPath (), "385638.xml");
try {
if (File.Exists (file))
File.Delete (file);
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
index 552060abdff..1dc3d5584ce 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
@@ -820,18 +820,20 @@ namespace MonoTests.System.Xml
// imported testcase from sys.security which had regression.
public void ResolveEntityAndBaseURI ()
{
+ string world = Path.Combine (Path.GetTempPath (), "world.txt");
+ string dtd = Path.Combine (Path.GetTempPath (), "doc.dtd");
try {
- using (TextWriter w = File.CreateText ("world.txt")) {
+ using (TextWriter w = File.CreateText (world)) {
w.WriteLine ("world");
}
- using (TextWriter w = File.CreateText ("doc.dtd")) {
+ using (TextWriter w = File.CreateText (dtd)) {
w.WriteLine ("<!-- dummy -->");
}
- string xml = "<!DOCTYPE doc SYSTEM \"doc.dtd\" [\n" +
+ string xml = String.Format ("<!DOCTYPE doc SYSTEM \"{1}\" [\n" +
"<!ATTLIST doc attrExtEnt ENTITY #IMPLIED>\n" +
"<!ENTITY ent1 \"Hello\">\n" +
- "<!ENTITY ent2 SYSTEM \"world.txt\">\n" +
+ "<!ENTITY ent2 SYSTEM \"{0}\">\n" +
"<!ENTITY entExt SYSTEM \"earth.gif\" NDATA gif>\n" +
"<!NOTATION gif SYSTEM \"viewgif.exe\">\n" +
"]>\n" +
@@ -839,7 +841,8 @@ namespace MonoTests.System.Xml
" &ent1;, &ent2;!\n" +
"</doc>\n" +
"\n" +
- "<!-- Let world.txt contain \"world\" (excluding the quotes) -->\n";
+ "<!-- Let world.txt contain \"world\" (excluding the quotes) -->\n",
+ world, dtd);
XmlValidatingReader xvr =
new XmlValidatingReader (
@@ -851,10 +854,10 @@ namespace MonoTests.System.Xml
doc.Load (xvr);
} finally {
- if (File.Exists ("world.txt"))
- File.Delete ("world.txt");
- if (File.Exists ("doc.dtd"))
- File.Delete ("doc.dtd");
+ if (File.Exists (world))
+ File.Delete (world);
+ if (File.Exists (dtd))
+ File.Delete (dtd);
}
}