X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fgenerics-invoke-byref.2.cs;h=26088d7e30d26bddaba324b645eb3a28acd5b1dc;hb=f03a1b538bfb0d9be810688e8713731e122320b5;hp=d62aa346a60b010b8fc5f1b78863921446b37e94;hpb=1caac3a2ed4fea68ef84a603f44651119497a774;p=mono.git diff --git a/mono/tests/generics-invoke-byref.2.cs b/mono/tests/generics-invoke-byref.2.cs index d62aa346a60..26088d7e30d 100644 --- a/mono/tests/generics-invoke-byref.2.cs +++ b/mono/tests/generics-invoke-byref.2.cs @@ -5,23 +5,48 @@ namespace TestConsole { class Program { - static void Main(string[] args) + static int Main(string[] args) { - List str = null; + List str = null; - object[] methodArgs = new object[] { str }; + object[] methodArgs = new object[] { str }; - Program p = new Program(); - p.GetType().GetMethod("TestMethod").Invoke(p, methodArgs); + Program p = new Program(); + p.GetType().GetMethod("TestMethod").Invoke(p, methodArgs); + + /* Byref nullable tests */ + object[] a = new object [1]; + int? i = 5; + object o = i; + a [0] = o; + typeof (Program).GetMethod ("TestMethodNullable").Invoke (p, a); + if ((int)a [0] != 6) + return 1; + if ((int)o != 5) + return 2; + + a [0] = null; + typeof (Program).GetMethod ("TestMethodNullable").Invoke (p, a); + if ((int)a [0] != 0) + return 3; + + return 0; } - public Program() - { - } + public Program() + { + } public void TestMethod(ref List strArg) { strArg = new List(); } + + public void TestMethodNullable (ref int? x) { + if (x != null) + x ++; + else + x = 0; + } } }