mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
refactor!: use Finalizer
to automatically free allocated memory for objects
BREAKING CHANGE: signature change for remote and repository callbacks during repository clone operation.
This commit is contained in:
parent
94c40f9a94
commit
b589097c8c
73 changed files with 1073 additions and 1618 deletions
|
@ -29,8 +29,6 @@ void main() {
|
|||
|
||||
expect(annotated.oid, tip);
|
||||
expect(annotated.refName, '');
|
||||
|
||||
annotated.free();
|
||||
});
|
||||
|
||||
test('throws when trying to lookup annotated commit with invalid oid', () {
|
||||
|
@ -49,25 +47,18 @@ void main() {
|
|||
|
||||
expect(annotated.oid, reference.target);
|
||||
expect(annotated.refName, 'refs/heads/master');
|
||||
|
||||
annotated.free();
|
||||
reference.free();
|
||||
});
|
||||
|
||||
test(
|
||||
'throws when trying to create annotated commit from provided '
|
||||
'reference and error occurs', () {
|
||||
final reference = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
|
||||
expect(
|
||||
() => AnnotatedCommit.fromReference(
|
||||
repo: Repository(nullptr),
|
||||
reference: reference,
|
||||
reference: Reference.lookup(repo: repo, name: 'refs/heads/master'),
|
||||
),
|
||||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
|
||||
reference.free();
|
||||
});
|
||||
|
||||
test('creates annotated commit from provided revspec', () {
|
||||
|
@ -75,8 +66,6 @@ void main() {
|
|||
|
||||
expect(annotated.oid.sha, '5aecfa0fb97eadaac050ccb99f03c3fb65460ad4');
|
||||
expect(annotated.refName, '');
|
||||
|
||||
annotated.free();
|
||||
});
|
||||
|
||||
test('throws when trying to create annotated commit from invalid revspec',
|
||||
|
@ -98,8 +87,6 @@ void main() {
|
|||
|
||||
expect(annotated.oid, oid);
|
||||
expect(annotated.refName, 'master');
|
||||
|
||||
annotated.free();
|
||||
});
|
||||
|
||||
test(
|
||||
|
@ -115,5 +102,10 @@ void main() {
|
|||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
});
|
||||
|
||||
test('manually releases allocated memory', () {
|
||||
final annotated = AnnotatedCommit.lookup(repo: repo, oid: tip);
|
||||
expect(() => annotated.free(), returnsNormally);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue