diff options
author | Marek Safar <marek.safar@gmail.com> | 2007-10-12 21:33:13 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2007-10-12 21:33:13 +0400 |
commit | 41c9fe71af3af9415c572f82ab3b2068520c3dad (patch) | |
tree | d07d11cd482ac7a35d82d2d8c50332544c35c75d /mcs/tests/test-275.cs | |
parent | da83f31d637ae24f07b87d412c6b3b222a444e80 (diff) |
A test for bug #333342
svn path=/trunk/mcs/; revision=87411
Diffstat (limited to 'mcs/tests/test-275.cs')
-rw-r--r-- | mcs/tests/test-275.cs | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/mcs/tests/test-275.cs b/mcs/tests/test-275.cs index f3f047b68b2..924526e339f 100644 --- a/mcs/tests/test-275.cs +++ b/mcs/tests/test-275.cs @@ -1,29 +1,48 @@ -using System; +using System; using System.Reflection; using System.Runtime.CompilerServices; -public class Test -{ - public delegate void DelType(); - - public event DelType MyEvent; - - public static int Main() - { - EventInfo ei = typeof(Test).GetEvent ("MyEvent"); - MethodImplAttributes methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags(); - - if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) { - Console.WriteLine ("FAILED"); - return 1; - } - - methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags(); - if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) { - Console.WriteLine ("FAILED"); - return 2; - } - - return 0; - } +public delegate void DelType (); + +struct S +{ + public event DelType MyEvent; +} + +public class Test +{ + public event DelType MyEvent; + + public static int Main () + { + EventInfo ei = typeof (Test).GetEvent ("MyEvent"); + MethodImplAttributes methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags (); + + if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) { + Console.WriteLine ("FAILED"); + return 1; + } + + methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags (); + if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) { + Console.WriteLine ("FAILED"); + return 2; + } + + ei = typeof (S).GetEvent ("MyEvent"); + methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags (); + + if ((methodImplAttributes & MethodImplAttributes.Synchronized) != 0) { + Console.WriteLine ("FAILED"); + return 3; + } + + methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags (); + if ((methodImplAttributes & MethodImplAttributes.Synchronized) != 0) { + Console.WriteLine ("FAILED"); + return 4; + } + + return 0; + } } |