Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/d7e3f8f1bb10...e00cbf2c426f
Commit: 40eaa78a8dc7082fe83d6683e8f44c342a0f5ed5
Author: Alexander Köplinger <[email protected]> (akoeplinger)
Date: 2013-10-25 17:52:36 GMT
URL: https://github.com/mono/mono/commit/40eaa78a8dc7082fe83d6683e8f44c342a0f5ed5
Fixed a test issue where net45 methods were used in net40 profile
Changed paths:
M mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs
M mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
Modified: mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs
===================================================================
@@ -202,12 +202,12 @@ public void TakeAnyFromSecondCollection ()
var arr = new [] { a, b };
string res = null;
- Task<int> t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res));
+ Task<int> t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res));
a.Add ("foo");
Assert.AreEqual (0, t.Result, "#1");
Assert.AreEqual ("foo", res, "#2");
- t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res));
+ t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res));
b.Add ("bar");
Assert.AreEqual (1, t.Result, "#3");
Assert.AreEqual ("bar", res, "#4");
@@ -222,19 +222,19 @@ public void TakeAnyCancellable ()
var cts = new CancellationTokenSource ();
string res = null;
- Task<int> t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
+ Task<int> t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
Thread.Sleep (100);
a.Add ("foo");
Assert.AreEqual (0, t.Result, "#1");
Assert.AreEqual ("foo", res, "#2");
- t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
+ t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
Thread.Sleep (100);
b.Add ("bar");
Assert.AreEqual (1, t.Result, "#3");
Assert.AreEqual ("bar", res, "#4");
- t = Task.Run (() => {
+ t = Task.Factory.StartNew (() => {
try {
return BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token);
} catch (OperationCanceledException WE_GOT_CANCELED) {
Modified: mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
===================================================================
@@ -284,7 +284,9 @@ public void ContinueWhenAny_Simple ()
[Test]
public void ContinueWhenAny_WithResult ()
{
- Task[] tasks = new[] { Task.FromResult (1) };
+ var tcs = new TaskCompletionSource<int>();
+ tcs.SetResult(1);
+ Task[] tasks = new[] { tcs.Task };
var res = Task.Factory.ContinueWhenAny (tasks, l => 4);
Assert.AreEqual (4, res.Result);
}
Commit: e00cbf2c426fe8309b377a50de503dfec163b15d
Author: Marek Safar <[email protected]> (marek-safar)
Date: 2013-10-26 07:11:19 GMT
URL: https://github.com/mono/mono/commit/e00cbf2c426fe8309b377a50de503dfec163b15d
Merge pull request #790 from akoeplinger/fixtests
Fixed a test issue where net45 methods were used in net40 profile
Changed paths:
M mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs
M mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
Modified: mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs
===================================================================
@@ -202,12 +202,12 @@ public void TakeAnyFromSecondCollection ()
var arr = new [] { a, b };
string res = null;
- Task<int> t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res));
+ Task<int> t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res));
a.Add ("foo");
Assert.AreEqual (0, t.Result, "#1");
Assert.AreEqual ("foo", res, "#2");
- t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res));
+ t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res));
b.Add ("bar");
Assert.AreEqual (1, t.Result, "#3");
Assert.AreEqual ("bar", res, "#4");
@@ -222,19 +222,19 @@ public void TakeAnyCancellable ()
var cts = new CancellationTokenSource ();
string res = null;
- Task<int> t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
+ Task<int> t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
Thread.Sleep (100);
a.Add ("foo");
Assert.AreEqual (0, t.Result, "#1");
Assert.AreEqual ("foo", res, "#2");
- t = Task.Run (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
+ t = Task.Factory.StartNew (() => BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token));
Thread.Sleep (100);
b.Add ("bar");
Assert.AreEqual (1, t.Result, "#3");
Assert.AreEqual ("bar", res, "#4");
- t = Task.Run (() => {
+ t = Task.Factory.StartNew (() => {
try {
return BlockingCollection<string>.TakeFromAny (arr, out res, cts.Token);
} catch (OperationCanceledException WE_GOT_CANCELED) {
Modified: mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
===================================================================
@@ -284,7 +284,9 @@ public void ContinueWhenAny_Simple ()
[Test]
public void ContinueWhenAny_WithResult ()
{
- Task[] tasks = new[] { Task.FromResult (1) };
+ var tcs = new TaskCompletionSource<int>();
+ tcs.SetResult(1);
+ Task[] tasks = new[] { tcs.Task };
var res = Task.Factory.ContinueWhenAny (tasks, l => 4);
Assert.AreEqual (4, res.Result);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.