[Mono-bugs] [Bug 45876][Nor] Changed - Attributes on operators are specified twice in the MSIL

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sun, 13 Jul 2003 21:37:46 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jc@manoli.net.

http://bugzilla.ximian.com/show_bug.cgi?id=45876

--- shadow/45876	Sun Jul 13 14:01:05 2003
+++ shadow/45876.tmp.2313	Sun Jul 13 21:37:46 2003
@@ -118,6 +118,50 @@
 This bug has been fixed in CVS. Could you please write up a test case
 which checks by reflection that the number of attributes applied are
 correct ? I shall add that to our test suite. Thanks very much.
 
 
 Leaving this bug open until then.
+
+------- Additional Comments From jc@manoli.net  2003-07-13 21:37 -------
+Here's an NUnit test case for this bug.  
+Reference %MONO_PATH%\NUnit.Framework.dll to compile.
+
+------------
+
+using System;
+using System.Reflection;
+using System.ComponentModel;
+using NUnit.Framework;
+
+namespace Test.AttributeOnOperator
+{
+	[TestFixture]
+	public class BrowsableClass
+	{
+		/// <summary>
+		/// Test case for mono bug #45876: verify that only 
+one attribute is generated for operators.
+		/// </summary>
+		[Test]
+		public void TestOperatorAttributeCount()
+		{
+			MethodInfo mi = this.GetType().GetMethod
+("op_Increment");
+			object[] attributes = mi.GetCustomAttributes
+(typeof(EditorBrowsableAttribute), false);
+			Assertion.AssertEquals("Operator attribute 
+count check", 1, attributes.Length);
+		}
+
+		/// <summary>
+		/// Used by TestOperatorAttributeCount().
+		/// </summary>
+		[EditorBrowsable(EditorBrowsableState.Always)]
+		public static BrowsableClass operator ++
+(BrowsableClass a) 
+		{ 
+			return null; 
+		}
+	}
+}
+