Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mcs / tests / test-async-13.cs
index 303bf8bd9887503eb4ce7da2590b556ceaa8b4eb..9f8cccac0700e535ade3411b92766ae7c006c939 100644 (file)
@@ -1,10 +1,9 @@
-// Compiler options: -langversion:future
-
 using System;
 using System.Threading.Tasks;
 using System.Threading;
 using System.Reflection;
 using System.Linq;
+using System.Runtime.CompilerServices;
 
 struct S
 {
@@ -341,6 +340,28 @@ class Tester : Base
                return 0;
        }
        
+       async Task<int> BinaryTest_5 ()
+       {
+               var r1 = await Task.FromResult (1) == 9;
+               if (r1)
+                       return 1;
+               
+               var r2 = 1 == await Task.FromResult (1);
+               if (!r2)
+                       return 2;
+               
+               return 0;
+       }
+
+       async Task<bool> BinaryTest_6 ()
+       {
+               var t = Task.Delay (1);
+               if (t == await Task.WhenAny(new [] { t }))
+                       return true;
+
+               return false;
+       }
+
        async Task<int> CallTest_1 ()
        {
                return Call (
@@ -657,6 +678,12 @@ class Tester : Base
                return a.Length == 13;
        }
        
+       async Task<bool> NewArrayInitTest_7 ()
+       {
+               var res = new [] { "a", new [] { "1", await Task.FromResult ("2") } [1], "b" };
+               return res [1] == "2";
+       }
+
        async Task<bool> PropertyTest_1 ()
        {
                PropertyInt = await Task.Factory.StartNew (() => 6);
@@ -762,7 +789,7 @@ class Tester : Base
        public static int Main ()
        {
                var tests = from test in typeof (Tester).GetMethods (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)
-                                       where test.GetParameters ().Length == 0
+                                       where test.GetParameters ().Length == 0 && !test.IsDefined (typeof (CompilerGeneratedAttribute), false)
                                        orderby test.Name
                                        select RunTest (test);