mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(blob): add bindings and api
This commit is contained in:
parent
88d064bda2
commit
f0803298c8
14 changed files with 455 additions and 143 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue