Skip to content

Commit

Permalink
Merge pull request #75 from atilaneves/coverage
Browse files Browse the repository at this point in the history
Coverage
  • Loading branch information
atilaneves authored Sep 22, 2023
2 parents 3227669 + 2174a51 commit 3d452c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/ut/ref_counted.d
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ mixin TestUtils;
@("default.struct.shared")
@system unittest {
{
auto ptr = RefCounted!(shared SharedStruct)(5);
auto ptr0 = RefCounted!(shared SharedStruct)(5);
SharedStruct.numStructs.shouldEqual(1);
auto ptr2 = ptr0; // copying the pointer ups the ref count but not # of structs
SharedStruct.numStructs.should == 1;
}
SharedStruct.numStructs.shouldEqual(0);
}
Expand Down
8 changes: 6 additions & 2 deletions tests/ut/vector.d
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ private void consumeVec(T)(auto ref T vec) {

@("foreach")
@safe unittest {
foreach(e; vector(7, 7, 7).range) {
// can't be inline in the foreach otherwise disappears before anything happens
scope v = vector(7, 7, 7);
foreach(e; v.range) {
e.should == 7;
}
}
Expand Down Expand Up @@ -482,7 +484,9 @@ private void consumeVec(T)(auto ref T vec) {

@("String")
@safe unittest {
foreach(c; String("oooooo").range)
// can't be inline in the foreach otherwise disappears
auto s = String("oooooo");
foreach(c; s.range)
c.should == 'o';
}

Expand Down

0 comments on commit 3d452c0

Please sign in to comment.