Skip to content

Commit 6bcb423

Browse files
committed
fix test AsyncForeach
1 parent a3691c9 commit 6bcb423

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncForeach.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ public void AsyncForeach()
4141
// (the top of an "await foreach" loop) is reached three times *plus* twice
4242
// per loop iteration. So, in this case, with five loop iterations, we end
4343
// up with 3 + 5 * 2 = 13 hits.
44-
(14, 1), (15, 1), (17, 13), (18, 5), (19, 5), (20, 5), (21, 5), (22, 5),
45-
(24, 0), (25, 0), (26, 0), (27, 5), (29, 1), (30, 1),
44+
(13, 1), (15, 13), (16, 5), (17, 5), (18, 5), (19, 5), (20, 5), (22, 0),
45+
(23, 0), (24, 0), (25, 5), (27, 1), (28, 1),
4646
// Sum(IAsyncEnumerable<int>)
47-
(34, 1), (35, 1), (37, 9), (38, 3), (39, 3), (40, 3), (42, 1), (43, 1),
47+
(32, 1), (34, 9), (35, 3), (36, 3), (37, 3), (39, 1), (40, 1), (43, 1),
4848
// SumEmpty()
49-
(47, 1), (48, 1), (50, 3), (51, 0), (52, 0), (53, 0), (55, 1), (56, 1),
49+
(44, 1), (48, 0), (51, 1), (52, 1),
5050
// GenericAsyncForeach
51-
(59, 1), (60, 9), (61, 3), (62, 3), (63, 3), (64, 1)
51+
(56, 9), (57, 3), (58, 3), (59, 3), (60, 1)
5252
)
5353
.AssertBranchesCovered(BuildConfiguration.Debug,
5454
// SumWithATwist(IAsyncEnumerable<int>)
55-
(17, 2, 1), (17, 3, 5), (19, 0, 5), (19, 1, 0),
55+
(15, 2, 1), (15, 3, 5), (17, 0, 5), (17, 1, 0),
5656
// Sum(IAsyncEnumerable<int>)
57-
(37, 0, 1), (37, 1, 3),
57+
(34, 0, 1), (34, 1, 3),
5858
// SumEmpty()
5959
// If we never entered the loop, that's a branch not taken, which is
6060
// what we want to see.
61-
(50, 0, 1), (50, 1, 0),
62-
(60, 0, 1), (60, 1, 3)
63-
)
61+
(46, 0, 1), (46, 1, 0),
62+
(56, 0, 1), (56, 1, 3)
63+
)
6464
.ExpectedTotalNumberOfBranches(BuildConfiguration.Debug, 5);
6565
}
6666
finally

test/coverlet.core.coverage.tests/Samples/Instrumentation.AsyncForeach.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ async public ValueTask<int> SumWithATwist(IAsyncEnumerable<int> ints)
2727
return sum;
2828
}
2929

30-
3130
async public ValueTask<int> Sum(IAsyncEnumerable<int> ints)
3231
{
3332
int sum = 0;
@@ -40,7 +39,6 @@ async public ValueTask<int> Sum(IAsyncEnumerable<int> ints)
4039
return sum;
4140
}
4241

43-
4442
async public ValueTask<int> SumEmpty()
4543
{
4644
int sum = 0;

test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
<PropertyGroup>
55
<TargetFramework>net8.0</TargetFramework>
6+
<OutputType>Exe</OutputType>
67
<IsPackable>false</IsPackable>
78
<IsTestProject>true</IsTestProject>
89
<NoWarn>$(NoWarn);CS8002</NoWarn>
@@ -32,12 +33,6 @@
3233
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.xunit.extensions\coverlet.tests.xunit.extensions.csproj" />
3334

3435
<ProjectReference Include="$(RepoRoot)test\coverlet.core.tests.samples.netstandard\coverlet.core.tests.samples.netstandard.csproj" />
35-
<!---
36-
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.projectsample.empty\coverlet.tests.projectsample.empty.csproj" />
37-
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.projectsample.excludedbyattribute\coverlet.tests.projectsample.excludedbyattribute.csproj" />
38-
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.projectsample.fsharp\coverlet.tests.projectsample.fsharp.fsproj" />
39-
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.projectsample.netframework\coverlet.tests.projectsample.netframework.csproj" />
40-
<ProjectReference Include="$(RepoRoot)test\coverlet.tests.projectsample.vbmynamespace\coverlet.tests.projectsample.vbmynamespace.vbproj" />-->
4136
</ItemGroup>
4237

4338
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.targets" />

test/coverlet.core.tests/coverlet.core.tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
<PropertyGroup>
55
<TargetFramework>net8.0</TargetFramework>
6+
<OutputType>Exe</OutputType>
7+
<IsTestProject>true</IsTestProject>
68
<IsPackable>false</IsPackable>
79
<NoWarn>$(NoWarn);CS8002</NoWarn>
810
<MSBuildWarningsAsMessages>NU1702;NU1504;NU1008;NU1604</MSBuildWarningsAsMessages>

0 commit comments

Comments
 (0)