-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #61 Drop if and while that has IsCancellationRequested and replac…
…e condition with true if IsCancellationRequested is negated
- Loading branch information
Showing
7 changed files
with
112 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ impl | |
func | ||
Nuget | ||
numerics | ||
retval | ||
zomp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Generator.Tests; | ||
|
||
public class IsCancellationRequestedTests | ||
{ | ||
[Fact] | ||
public Task WhileNotCancelled() => $$""" | ||
while (((!((ct.IsCancellationRequested))))) | ||
{ | ||
await Task.Delay(120000, ct); | ||
} | ||
""".Verify(sourceType: SourceType.MethodBody); | ||
|
||
[Fact] | ||
public Task IfCancelled() => $$""" | ||
if (((((ct.IsCancellationRequested))))) | ||
{ | ||
await Task.Delay(120000, ct); | ||
} | ||
""".Verify(sourceType: SourceType.MethodBody); | ||
|
||
[Fact] | ||
public Task IfNotCancelled() => $$""" | ||
if (((!((ct.IsCancellationRequested))))) | ||
{ | ||
await Task.Delay(120000, ct); | ||
} | ||
""".Verify(sourceType: SourceType.MethodBody); | ||
} |
1 change: 1 addition & 0 deletions
1
tests/Generator.Tests/Snapshots/IsCancellationRequestedTests.IfCancelled#g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//HintName: Test.Class.MethodAsync.g.cs |
5 changes: 5 additions & 0 deletions
5
tests/Generator.Tests/Snapshots/IsCancellationRequestedTests.IfNotCancelled#g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//HintName: Test.Class.MethodAsync.g.cs | ||
if (true) | ||
{ | ||
global::System.Threading.Thread.Sleep(120000); | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/Generator.Tests/Snapshots/IsCancellationRequestedTests.WhileNotCancelled#g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//HintName: Test.Class.MethodAsync.g.cs | ||
while (true) | ||
{ | ||
global::System.Threading.Thread.Sleep(120000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters