feat(blob): add bindings and api

This commit is contained in:
Aleksey Kulikov 2021-09-02 17:00:09 +03:00
parent 88d064bda2
commit f0803298c8
14 changed files with 455 additions and 143 deletions

View file

@ -7,43 +7,43 @@ import 'helpers/util.dart';
void main() {
const mergeCommit = '78b8bf123e3952c970ae5c1ce0a3ea1d1336f6e8';
group('Commit', () {
late Repository repo;
final tmpDir = '${Directory.systemTemp.path}/commit_testrepo/';
late Repository repo;
final tmpDir = '${Directory.systemTemp.path}/commit_testrepo/';
const message = "Commit message.\n\nSome description.\n";
const tree = '7796359a96eb722939c24bafdb1afe9f07f2f628';
late Signature author;
late Signature commiter;
const message = "Commit message.\n\nSome description.\n";
const tree = '7796359a96eb722939c24bafdb1afe9f07f2f628';
late Signature author;
late Signature commiter;
setUp(() async {
if (await Directory(tmpDir).exists()) {
await Directory(tmpDir).delete(recursive: true);
}
await copyRepo(
from: Directory('test/assets/testrepo/'),
to: await Directory(tmpDir).create(),
);
repo = Repository.open(tmpDir);
author = Signature.create(
name: 'Author Name',
email: 'author@email.com',
time: 123,
);
commiter = Signature.create(
name: 'Commiter',
email: 'commiter@email.com',
time: 124,
);
});
tearDown(() async {
author.free();
commiter.free();
repo.free();
setUp(() async {
if (await Directory(tmpDir).exists()) {
await Directory(tmpDir).delete(recursive: true);
});
}
await copyRepo(
from: Directory('test/assets/testrepo/'),
to: await Directory(tmpDir).create(),
);
repo = Repository.open(tmpDir);
author = Signature.create(
name: 'Author Name',
email: 'author@email.com',
time: 123,
);
commiter = Signature.create(
name: 'Commiter',
email: 'commiter@email.com',
time: 124,
);
});
tearDown(() async {
author.free();
commiter.free();
repo.free();
await Directory(tmpDir).delete(recursive: true);
});
group('Commit', () {
test('successfully returns when 40 char sha hex is provided', () {
final commit = repo[mergeCommit];
expect(commit, isA<Commit>());