1 // Compiler options: -unsafe
4 using System
.Collections
.Generic
;
6 using System
.Reflection
;
7 using Microsoft
.CSharp
.RuntimeBinder
;
11 public unsafe static int* Foo (int i
)
19 #pragma warning disable 169
25 "Pointers and fixed size buffers cannot be used in a dynamic context");
28 #pragma warning restore 169
30 static void AssertError (Action a
, string msg
)
34 } catch (RuntimeBinderException e
) {
41 throw new ApplicationException ("Expected error");
44 static bool RunTest (MethodInfo test
)
46 Console
.Write ("Running test {0, -25}", test
.Name
);
48 test
.Invoke (new Tester (), null);
49 Console
.WriteLine ("OK");
51 } catch (Exception e
) {
52 Console
.WriteLine ("FAILED");
53 Console
.WriteLine (e
.InnerException
.Message
);
58 public static int Main ()
60 var tests
= from test
in typeof (Tester
).GetMethods (BindingFlags
.Instance
| BindingFlags
.NonPublic
| BindingFlags
.DeclaredOnly
)
61 where test
.GetParameters ().Length
== 0
63 select RunTest (test
);
65 int failures
= tests
.Count (a
=> !a
);
66 Console
.WriteLine (failures
+ " tests failed");