Author: benm
Date: 2005-04-30 12:02:32 -0400 (Sat, 30 Apr 2005)
New Revision: 43827
Modified:
trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
trunk/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
Log:
2005-04-30 Ben Maurer <[EMAIL PROTECTED]>
* TypeBuilderTest.cs: Don't write to a specific path in /tmp --
breaks multiple users.
Modified: trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
2005-04-30 14:07:46 UTC (rev 43826)
+++ trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
2005-04-30 16:02:32 UTC (rev 43827)
@@ -1,3 +1,8 @@
+2005-04-30 Ben Maurer <[EMAIL PROTECTED]>
+
+ * TypeBuilderTest.cs: Don't write to a specific path in /tmp --
+ breaks multiple users.
+
2005-04-28 Zoltan Varga <[EMAIL PROTECTED]>
* AssemblyBuilderTest.cs: Add test for GetModules ().
Modified: trunk/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
2005-04-30 14:07:46 UTC (rev 43826)
+++ trunk/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
2005-04-30 16:02:32 UTC (rev 43827)
@@ -389,7 +389,31 @@
TypeBuilder tb2 = module.DefineType (genTypeName (),
TypeAttributes.Sealed);
AssertEquals ("IsSealed works", true, tb2.IsSealed);
}
+
+ static string CreateTempAssembly ()
+ {
+ FileStream f = null;
+ string path;
+ Random rnd;
+ int num = 0;
+ rnd = new Random ();
+ do {
+ num = rnd.Next ();
+ num++;
+ path = Path.Combine (Path.GetTempPath(), "tmp" +
num.ToString("x") + ".dll");
+
+ try {
+ f = new FileStream (path, FileMode.CreateNew);
+ } catch {}
+ } while (f == null);
+
+ f.Close();
+
+
+ return "tmp" + num.ToString("x") + ".dll";
+ }
+
[Test]
public void IsSerializable () {
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -402,8 +426,10 @@
tb.SetCustomAttribute (new CustomAttributeBuilder (ctors[0],
new object[0]));
Type createdType = tb.CreateType ();
- assembly.Save ("TestAssembly.dll");
+ string an = CreateTempAssembly ();
+ assembly.Save (an);
AssertEquals (true, createdType.IsSerializable);
+ File.Delete (Path.Combine (Path.GetTempPath (), an));
}
[Test]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches