You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -82,36 +82,6 @@ namespace System.Threading.Tasks.Tests
|
||||
Assert.Equal(1, invokes);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public async Task AwaitOnCompleted_InvokesStateMachineMethods(bool awaitUnsafe)
|
||||
{
|
||||
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
|
||||
var ignored = b.Task;
|
||||
|
||||
var callbackCompleted = new TaskCompletionSource<bool>();
|
||||
IAsyncStateMachine foundSm = null;
|
||||
var dsm = new DelegateStateMachine
|
||||
{
|
||||
MoveNextDelegate = () => callbackCompleted.SetResult(true),
|
||||
SetStateMachineDelegate = sm => foundSm = sm
|
||||
};
|
||||
|
||||
TaskAwaiter t = Task.CompletedTask.GetAwaiter();
|
||||
if (awaitUnsafe)
|
||||
{
|
||||
b.AwaitUnsafeOnCompleted(ref t, ref dsm);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.AwaitOnCompleted(ref t, ref dsm);
|
||||
}
|
||||
|
||||
await callbackCompleted.Task;
|
||||
Assert.Equal(dsm, foundSm);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(1, false)]
|
||||
[InlineData(2, false)]
|
||||
@@ -149,7 +119,6 @@ namespace System.Threading.Tasks.Tests
|
||||
{
|
||||
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
|
||||
AssertExtensions.Throws<ArgumentNullException>("stateMachine", () => b.SetStateMachine(null));
|
||||
b.SetStateMachine(new DelegateStateMachine());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -214,8 +183,7 @@ namespace System.Threading.Tasks.Tests
|
||||
internal Action MoveNextDelegate;
|
||||
public void MoveNext() => MoveNextDelegate?.Invoke();
|
||||
|
||||
internal Action<IAsyncStateMachine> SetStateMachineDelegate;
|
||||
public void SetStateMachine(IAsyncStateMachine stateMachine) => SetStateMachineDelegate?.Invoke(stateMachine);
|
||||
public void SetStateMachine(IAsyncStateMachine stateMachine) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user