refactor!: use Finalizer to automatically free allocated memory for objects (#48)

BREAKING CHANGE: signature change for remote and repository callbacks during repository clone operation.
This commit is contained in:
Aleksey Kulikov 2022-04-28 11:04:48 +03:00 committed by GitHub
parent 94c40f9a94
commit a3213a88a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 2278 additions and 2595 deletions

View file

@ -24,7 +24,6 @@ void main() {
});
tearDown(() {
stasher.free();
repo.free();
tmpDir.deleteSync(recursive: true);
});
@ -62,14 +61,11 @@ void main() {
test('leaves changes added to index intact', () {
File(filePath).writeAsStringSync('edit', mode: FileMode.append);
final index = repo.index;
index.add('file');
repo.index.add('file');
Stash.create(repo: repo, stasher: stasher, flags: {GitStash.keepIndex});
expect(repo.status.isEmpty, false);
expect(repo.stashes.length, 1);
index.free();
});
test('applies changes from stash', () {
@ -109,8 +105,6 @@ void main() {
Stash.apply(repo: repo, reinstateIndex: true);
expect(repo.status, contains('stash.this'));
expect(index.find('stash.this'), true);
index.free();
});
test('throws when trying to apply with wrong index', () {
@ -182,8 +176,6 @@ void main() {
Stash.pop(repo: repo, reinstateIndex: true);
expect(repo.status, contains('stash.this'));
expect(index.find('stash.this'), true);
index.free();
});
test('throws when trying to pop with wrong index', () {