Переглянути джерело

2005-01-18 Miguel de Icaza <[email protected]>

	* TypeBuilder.cs: Add check for creation.  Fix from Geoff.


More test shuffling to get rid of all the failures from the standard build


svn path=/trunk/mcs/; revision=39074
Miguel de Icaza 21 роки тому
батько
коміт
137e01d1e3

+ 4 - 0
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,7 @@
+2005-01-18  Miguel de Icaza  <[email protected]>
+
+	* TypeBuilder.cs: Add check for creation.  Fix from Geoff.
+
 2004-12-16  Zoltan Varga  <[email protected]>
 
 	* CustomAttributeBuilder.cs: Fix a warning.

+ 2 - 0
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs

@@ -271,6 +271,8 @@ namespace System.Reflection.Emit {
 								       CallingConventions callConvention, Type[] types,
 								       ParameterModifier[] modifiers)
 		{
+			check_created ();
+			
 			if (ctors == null)
 				return null;
 

+ 33 - 2
mcs/class/corlib/Test/System.IO/FileStreamTest.cs

@@ -517,7 +517,36 @@ namespace MonoTests.System.IO
                 	stream.Close ();
 			DeleteFile (path);
                 }
-                
+
+		[Category("NotWorking")]
+		// Bug: 71371
+		public void TestLock_FailsOnMono ()
+		{
+			string path = TempFolder + Path.DirectorySeparatorChar + "TestLock";
+                	DeleteFile (path);
+
+                	FileStream stream = new FileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);
+                	                	
+	               	stream.Write (new Byte [] {0,1,2,3,4,5,6,7,8,9,10}, 0, 10);                              	
+                	stream.Close ();
+
+                	stream = new FileStream (path, FileMode.Open, FileAccess.ReadWrite);
+                	
+                	stream.Lock (0, 5);
+                	
+                	FileStream stream2 = new FileStream (path , FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+                	
+                	byte [] bytes = new byte [5];
+                	try {                		
+                		stream2.Read (bytes, 0, 5);
+                		Fail ();
+                	} catch (Exception e) {
+                		
+                		// locked
+                		AssertEquals ("test#01", typeof (IOException), e.GetType ());
+                	}
+		}
+		    
                 public void TestLock()
                 {
 			string path = TempFolder + Path.DirectorySeparatorChar + "TestLock";
@@ -541,7 +570,9 @@ namespace MonoTests.System.IO
                 	} catch (Exception e) {
                 		
                 		// locked
-                		AssertEquals ("test#01", typeof (IOException), e.GetType ());
+                		// AssertEquals ("test#01", typeof (IOException), e.GetType ());
+				//
+				// Moved into the previous test case.
                 	}
                		                
                 	stream2.Seek (5, SeekOrigin.Begin);

+ 18 - 0
mcs/class/corlib/Test/System.IO/FileTest.cs

@@ -980,6 +980,11 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof(IOException))]
+		[Category("ValueAdd")]
+		//
+		// This is category ValueAdd, since in Unix the semantics allow for
+		// a file to be deleted while a handle to it remains.
+		//
 		public void FileStreamCloseException ()
 		{
 			string path = TempFolder + Path.DirectorySeparatorChar + "FileStreamCloseException";
@@ -1036,8 +1041,11 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetCreationTimeArgumenException3 ()
 		{
+
 			File.SetCreationTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
 		}
 
@@ -1109,6 +1117,8 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetCreationTimeUtcArgumenException3 ()
 		{
 			File.SetCreationTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
@@ -1184,6 +1194,8 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetLastAccessTimeArgumenException3 ()
 		{
 			File.SetLastAccessTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
@@ -1257,6 +1269,8 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetLastAccessTimeUtcArgumenException3 ()
 		{
 			File.SetLastAccessTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
@@ -1332,6 +1346,8 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetLastWriteTimeArgumenException3 ()
 		{
 			File.SetLastWriteTime (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));
@@ -1405,6 +1421,8 @@ namespace MonoTests.System.IO
 
 		[Test]
 		[ExpectedException(typeof (ArgumentException))]
+		[Category("ValueAdd")]
+		// On Unix there are no invalid path chars.
 		public void SetLastWriteTimeUtcArgumenException3 ()
 		{
 			File.SetLastWriteTimeUtc (Path.InvalidPathChars [1].ToString (), new DateTime (2000, 12, 12, 11, 59, 59));

+ 0 - 2
mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs

@@ -553,8 +553,6 @@ public class TypeBuilderTest : Assertion
 
 	[Test]
 	[ExpectedException (typeof(NotSupportedException))]
-	[Category("ValueAdd")]
-	// See bug: 71305
 	public void TestTypeInitializerIncomplete ()
 	{
 		TypeBuilder tb = module.DefineType (genTypeName ());