Skip to content

Commit 3004bb7

Browse files
authored
Enable tests "Hang due to System.Console.ReadKey()" (#1707)
* enable tests "Hang due to System.Console.ReadKey()" * modify AssertInstrumentLines * remove attributes and comments
1 parent 7e0c7e8 commit 3004bb7

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

test/coverlet.core.tests/Coverage/CoverageTests.DoesNotReturn.cs

+10-14
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void NoBranches_DoesNotReturnAttribute_InstrumentsCorrect()
4545
}
4646
}
4747

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

7070
result.Document("Instrumentation.DoesNotReturn.cs")
71-
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 19, 20, 22, 23, 24, 25, 29, 30)
72-
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 26, 27);
71+
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 19, 20, 22, 23, 24, 25, 29, 30, 26, 27);
7372
}
7473
finally
7574
{
7675
File.Delete(path);
7776
}
7877
}
7978

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

102101
result.Document("Instrumentation.DoesNotReturn.cs")
103-
.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)
104-
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 41, 42);
102+
.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);
105103
}
106104
finally
107105
{
108106
File.Delete(path);
109107
}
110108
}
111109

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

134132
result.Document("Instrumentation.DoesNotReturn.cs")
135-
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 72, 73, 75, 78, 82, 83, 86, 87, 91, 92, 95, 101, 102, 103)
136-
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 79, 80, 88, 96, 98, 99);
133+
.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);
137134
}
138135
finally
139136
{
140137
File.Delete(path);
141138
}
142139
}
143140

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

166163
result.Document("Instrumentation.DoesNotReturn.cs")
167-
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 106, 107, 108)
168-
.AssertNonInstrumentedLines(BuildConfiguration.Debug, 110, 111, 112, 113, 114);
164+
.AssertInstrumentLines(BuildConfiguration.Debug, 7, 8, 106, 107, 108, 110, 111, 112, 113, 114);
169165
}
170166
finally
171167
{
@@ -270,7 +266,7 @@ public void WithLeave_DoesNotReturnAttribute_InstrumentsCorrect()
270266
}
271267

272268
[Fact]
273-
public void FiltersAndFinallies_DoesNotReturnAttribute_InstrumentsCorrect()
269+
public void FiltersAndFinally_DoesNotReturnAttribute_InstrumentsCorrect()
274270
{
275271
string path = Path.GetTempFileName();
276272
try
@@ -279,7 +275,7 @@ public void FiltersAndFinallies_DoesNotReturnAttribute_InstrumentsCorrect()
279275
{
280276
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<DoesNotReturn>(instance =>
281277
{
282-
try { instance.FiltersAndFinallies(); }
278+
try { instance.FiltersAndFinally(); }
283279
catch (Exception) { }
284280
return Task.CompletedTask;
285281

test/coverlet.core.tests/Samples/Instrumentation.DoesNotReturn.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void Subtle()
8585
case 'C':
8686
System.Console.WriteLine("In-Constant-3");
8787
Throws();
88-
goto alwayUnreachable; // unreachable
88+
goto alwaysUnreachable; // unreachable
8989

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

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

101101
subtlyReachable:
@@ -167,7 +167,7 @@ public void WithLeave()
167167
System.Console.WriteLine("Constant-2");
168168
}
169169

170-
public void FiltersAndFinallies()
170+
public void FiltersAndFinally()
171171
{
172172
try
173173
{

0 commit comments

Comments
 (0)