test: add more tests for throws and their messages

This commit is contained in:
Aleksey Kulikov 2021-10-19 17:16:39 +03:00
parent d6eae1e9ed
commit 127849519d
80 changed files with 2741 additions and 1501 deletions

View file

@ -29,6 +29,19 @@ void main() {
expect(tree.toString(), contains('Tree{'));
});
test('throws when looking up tree for invalid oid', () {
expect(
() => repo.lookupTree(repo['0' * 40]),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"odb: cannot read object: null OID cannot exist",
),
),
);
});
test('returns correct values', () {
expect(tree.length, 4);
expect(tree.entries.first.oid.sha, fileSHA);