Commit 09ca0fc4 authored by Nick Craver's avatar Nick Craver

Tests: fix VerifyIsSyncSafe for current behavior

This is a static init...it's not going to vary. We should probably drop net45 and just delete this whole concept from the code.
parent 12edbf52
...@@ -11,13 +11,20 @@ public class TaskTests ...@@ -11,13 +11,20 @@ public class TaskTests
#if !PLAT_SAFE_CONTINUATIONS // IsSyncSafe doesn't exist if PLAT_SAFE_CONTINUATIONS is defined #if !PLAT_SAFE_CONTINUATIONS // IsSyncSafe doesn't exist if PLAT_SAFE_CONTINUATIONS is defined
[Theory] [Theory]
[InlineData(SourceOrign.NewTCS, false)] [InlineData(SourceOrign.NewTCS)]
[InlineData(SourceOrign.Create, false)] [InlineData(SourceOrign.Create)]
[InlineData(SourceOrign.CreateDenyExec, true)] public void VerifyIsSyncSafe(SourceOrign origin)
public void VerifyIsSyncSafe(SourceOrign origin, bool expected)
{ {
var source = Create<int>(origin); var source = Create<int>(origin);
Assert.Equal(expected, TaskSource.IsSyncSafe(source.Task)); // Yes this looks stupid, but it's the proper pattern for how we statically init now
// ...and if we're dropping NET45 support, we can just nuke it all.
#if NET462
Assert.True(TaskSource.IsSyncSafe(source.Task));
#elif NETCOREAPP1_0
Assert.True(TaskSource.IsSyncSafe(source.Task));
#elif NETCOREAPP2_0
Assert.True(TaskSource.IsSyncSafe(source.Task));
#endif
} }
#endif #endif
private static TaskCompletionSource<T> Create<T>(SourceOrign origin) private static TaskCompletionSource<T> Create<T>(SourceOrign origin)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment