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

@ -269,6 +269,41 @@ void main() {
expect(repo.isBranchUnborn, true);
});
});
group('createBlob', () {
const newBlobContent = 'New blob\n';
test('successfully creates new blob', () {
final oid = repo.createBlob(newBlobContent);
final newBlob = Blob.lookup(repo, oid);
expect(newBlob, isA<Blob>());
newBlob.free();
});
test(
'successfully creates new blob from file at provided relative path',
() {
final oid = repo.createBlobFromWorkdir('feature_file');
final newBlob = Blob.lookup(repo, oid);
expect(newBlob, isA<Blob>());
newBlob.free();
});
test('successfully creates new blob from file at provided path', () {
final outsideFile =
File('${Directory.current.absolute.path}/test/blob_test.dart');
final oid = repo.createBlobFromDisk(outsideFile.path);
final newBlob = Blob.lookup(repo, oid);
expect(newBlob, isA<Blob>());
newBlob.free();
});
});
});
});
}