Skip to content

Commit 4283436

Browse files
committed
Add test for shouldDuplicate
1 parent 11a17cb commit 4283436

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/tests/commit.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,4 +672,26 @@ describe("Commit", function() {
672672
assert.equal(startNonSelfFreeingCount, endNonSelfFreeingCount);
673673
});
674674
});
675+
676+
it("duplicates signature", function() {
677+
garbageCollect();
678+
var Signature = NodeGit.Signature;
679+
var startSelfFreeingCount = Signature.getSelfFreeingInstanceCount();
680+
var startNonSelfFreeingCount =
681+
Signature.getNonSelfFreeingConstructedCount();
682+
var signature = this.commit.author();
683+
684+
garbageCollect();
685+
var endSelfFreeingCount = Signature.getSelfFreeingInstanceCount();
686+
var endNonSelfFreeingCount = Signature.getNonSelfFreeingConstructedCount();
687+
// we should get one duplicated, self-freeing signature
688+
assert.equal(startSelfFreeingCount + 1, endSelfFreeingCount);
689+
assert.equal(startNonSelfFreeingCount, endNonSelfFreeingCount);
690+
691+
signature = null;
692+
garbageCollect();
693+
endSelfFreeingCount = Signature.getSelfFreeingInstanceCount();
694+
// the self-freeing signature should get freed
695+
assert.equal(startSelfFreeingCount, endSelfFreeingCount);
696+
});
675697
});

0 commit comments

Comments
 (0)