[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / test-181.cs
blob526f238285fea10be61d84ad175f8618e6633a13
1 //
2 // test-181.cs: Test whenever mcs correctly handles the MethodImplAttributes
3 // custom attribute.
4 //
6 using System;
7 using System.Reflection;
8 using System.Runtime.CompilerServices;
10 class Test
12 [MethodImplAttribute(MethodImplOptions.Synchronized)]
13 public void test ()
17 [MethodImplAttribute((short)MethodImplOptions.Synchronized)]
18 public void test2 ()
22 [MethodImplAttribute((byte)32)]
23 public void test3 ()
27 [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
28 public void test4 ()
32 public static int Main ()
34 MethodImplAttributes iflags;
35 iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
36 if ((iflags & MethodImplAttributes.Synchronized) == 0)
37 return 1;
39 iflags = typeof (Test).GetMethod ("test2").GetMethodImplementationFlags ();
40 if ((iflags & MethodImplAttributes.Synchronized) == 0)
41 return 2;
43 iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
44 if ((iflags & MethodImplAttributes.Synchronized) == 0)
45 return 3;
47 iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
48 if ((iflags & MethodImplAttributes.Synchronized) == 0)
49 return 4;
51 return 0;