mirror of https://github.com/Cysharp/UniTask
Compare commits
1 Commits
6a9a79cb97
...
9da23aaf74
Author | SHA1 | Date |
---|---|---|
|
9da23aaf74 |
|
@ -159,30 +159,6 @@ namespace NetCoreTests.Linq
|
||||||
list.Should().Equal(100, 200, 300, 400);
|
list.Should().Equal(100, 200, 300, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task AwaitForeachBreak()
|
|
||||||
{
|
|
||||||
var finallyCalled = false;
|
|
||||||
var enumerable = UniTaskAsyncEnumerable.Create<int>(async (writer, _) =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await writer.YieldAsync(1);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
finallyCalled = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await foreach (var x in enumerable)
|
|
||||||
{
|
|
||||||
x.Should().Be(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
finallyCalled.Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
async IAsyncEnumerable<int> Range(int from, int count)
|
async IAsyncEnumerable<int> Range(int from, int count)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
|
|
|
@ -52,7 +52,6 @@ namespace Cysharp.Threading.Tasks.Linq
|
||||||
public UniTask DisposeAsync()
|
public UniTask DisposeAsync()
|
||||||
{
|
{
|
||||||
TaskTracker.RemoveTracking(this);
|
TaskTracker.RemoveTracking(this);
|
||||||
writer.Dispose();
|
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +127,7 @@ namespace Cysharp.Threading.Tasks.Linq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AsyncWriter : IUniTaskSource, IAsyncWriter<T>, IDisposable
|
sealed class AsyncWriter : IUniTaskSource, IAsyncWriter<T>
|
||||||
{
|
{
|
||||||
readonly _Create enumerator;
|
readonly _Create enumerator;
|
||||||
|
|
||||||
|
@ -139,15 +138,6 @@ namespace Cysharp.Threading.Tasks.Linq
|
||||||
this.enumerator = enumerator;
|
this.enumerator = enumerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
var status = core.GetStatus(core.Version);
|
|
||||||
if (status == UniTaskStatus.Pending)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetResult(short token)
|
public void GetResult(short token)
|
||||||
{
|
{
|
||||||
core.GetResult(token);
|
core.GetResult(token);
|
||||||
|
|
Loading…
Reference in New Issue