Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

enable tests "Hang due to System.Console.ReadKey()" #1707

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions test/coverlet.core.tests/Coverage/CoverageTests.DoesNotReturn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void NoBranches_DoesNotReturnAttribute_InstrumentsCorrect()
}
}

[Fact(Skip = "Hang due to System.Console.ReadKey()")]
[Fact]
public void If_DoesNotReturnAttribute_InstrumentsCorrect()
{
string path = Path.GetTempFileName();
Expand All @@ -68,16 +68,15 @@ public void If_DoesNotReturnAttribute_InstrumentsCorrect()
CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

result.Document("Instrumentation.DoesNotReturn.cs")
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 19, 20, 22, 23, 24, 25, 29, 30)
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 26, 27);
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 19, 20, 22, 23, 24, 25, 29, 30, 26, 27);
}
finally
{
File.Delete(path);
}
}

[Fact(Skip = "Hang due to System.Console.ReadKey()")]
[Fact]
public void Switch_DoesNotReturnAttribute_InstrumentsCorrect()
{
string path = Path.GetTempFileName();
Expand All @@ -100,16 +99,15 @@ public void Switch_DoesNotReturnAttribute_InstrumentsCorrect()
CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

result.Document("Instrumentation.DoesNotReturn.cs")
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 33, 34, 36, 39, 40, 44, 45, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 68, 69)
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 41, 42);
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 33, 34, 36, 39, 40, 44, 45, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 68, 69, 41, 42);
}
finally
{
File.Delete(path);
}
}

[Fact(Skip = "Hang due to System.Console.ReadKey()")]
[Fact]
public void Subtle_DoesNotReturnAttribute_InstrumentsCorrect()
{
string path = Path.GetTempFileName();
Expand All @@ -132,16 +130,15 @@ public void Subtle_DoesNotReturnAttribute_InstrumentsCorrect()
CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

result.Document("Instrumentation.DoesNotReturn.cs")
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 72, 73, 75, 78, 82, 83, 86, 87, 91, 92, 95, 101, 102, 103)
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 79, 80, 88, 96, 98, 99);
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 72, 73, 75, 78, 82, 83, 86, 87, 91, 92, 95, 101, 102, 103, 79, 80, 88, 96, 98, 99);
}
finally
{
File.Delete(path);
}
}

[Fact(Skip = "Hang due to System.Console.ReadKey()")]
[Fact]
public void UnreachableBranch_DoesNotReturnAttribute_InstrumentsCorrect()
{
string path = Path.GetTempFileName();
Expand All @@ -164,8 +161,7 @@ public void UnreachableBranch_DoesNotReturnAttribute_InstrumentsCorrect()
CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

result.Document("Instrumentation.DoesNotReturn.cs")
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 106, 107, 108)
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 110, 111, 112, 113, 114);
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 106, 107, 108, 110, 111, 112, 113, 114);
}
finally
{
Expand Down Expand Up @@ -270,7 +266,7 @@ public void WithLeave_DoesNotReturnAttribute_InstrumentsCorrect()
}

[Fact]
public void FiltersAndFinallies_DoesNotReturnAttribute_InstrumentsCorrect()
public void FiltersAndFinally_DoesNotReturnAttribute_InstrumentsCorrect()
{
string path = Path.GetTempFileName();
try
Expand All @@ -279,7 +275,7 @@ public void FiltersAndFinallies_DoesNotReturnAttribute_InstrumentsCorrect()
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<DoesNotReturn>(instance =>
{
try { instance.FiltersAndFinallies(); }
try { instance.FiltersAndFinally(); }
catch (Exception) { }
return Task.CompletedTask;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void Subtle()
case 'C':
System.Console.WriteLine("In-Constant-3");
Throws();
goto alwayUnreachable; // unreachable
goto alwaysUnreachable; // unreachable

case 'D':
System.Console.WriteLine("In-Constant-4");
Expand All @@ -95,7 +95,7 @@ public void Subtle()
Throws();
System.Console.WriteLine("Out-Constant-1"); // unreachable

alwayUnreachable: // unreachable
alwaysUnreachable: // unreachable
System.Console.WriteLine("Out-Constant-2"); // unreachable

subtlyReachable:
Expand Down Expand Up @@ -167,7 +167,7 @@ public void WithLeave()
System.Console.WriteLine("Constant-2");
}

public void FiltersAndFinallies()
public void FiltersAndFinally()
{
try
{
Expand Down