Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs')
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
index 74d5c548852..5237e377e38 100644
--- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
@@ -178,7 +178,7 @@ namespace MonoTests.System.Runtime.CompilerServices
Assert.IsTrue (t.Wait (3000), "#0");
Assert.AreEqual (0, t.Result, "#1");
Assert.AreEqual (0, b.InlineCalls, "#2b");
- Assert.AreEqual (2, a.QueueCalls, "#3a");
+ Assert.IsTrue (a.QueueCalls == 1 || a.QueueCalls == 2, "#3a");
Assert.AreEqual (1, b.QueueCalls, "#3b");
}
@@ -278,7 +278,9 @@ namespace MonoTests.System.Runtime.CompilerServices
SynchronizationContext.SetSynchronizationContext (syncContext);
syncContext.Post (delegate {
- Go2 (syncContext);
+ Task t = new Task (delegate() { });
+ Go2 (syncContext, t);
+ t.Start ();
}, null);
// Custom message loop
@@ -289,24 +291,29 @@ namespace MonoTests.System.Runtime.CompilerServices
Thread.Sleep (0);
}
- Assert.AreEqual ("132", progress);
+ Assert.AreEqual ("13xa2", progress);
}
- async void Go2 (SynchronizationContext ctx)
+ async void Go2 (SynchronizationContext ctx, Task t)
{
- await Wait2 (ctx);
+ await Wait2 (ctx, t);
+
+ progress += "a";
if (mre.WaitOne (5000))
progress += "2";
+ else
+ progress += "b";
}
- async Task Wait2 (SynchronizationContext ctx)
+ async Task Wait2 (SynchronizationContext ctx, Task t)
{
- await Task.Delay (10); // Force block suspend/return
+ await t; // Force block suspend/return
ctx.Post (l => {
progress += "3";
mre.Set ();
+ progress += "x";
}, null);
progress += "1";