test: remove checks for messages of throws

Platform specific messages for throws is different, so checking that test
throws proper type should be enough
This commit is contained in:
Aleksey Kulikov 2021-10-27 16:44:04 +03:00
parent 8791527ad9
commit 7f0cd86e72
35 changed files with 171 additions and 1331 deletions

View file

@ -34,13 +34,7 @@ void main() {
test('throws when trying to lookup with invalid oid', () {
expect(
() => repo.lookupBlob(repo['0' * 40]),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
'odb: cannot read object: null OID cannot exist',
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -67,13 +61,7 @@ void main() {
final nullRepo = Repository(nullptr);
expect(
() => Blob.create(repo: nullRepo, content: ''),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"invalid argument: 'repo'",
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -93,13 +81,7 @@ void main() {
test('throws when creating new blob from invalid path', () {
expect(
() => repo.createBlobFromWorkdir('invalid/path.txt'),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"could not find '${repo.workdir}invalid/path.txt' to stat: No such file or directory",
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -118,13 +100,7 @@ void main() {
test('throws when trying to create from invalid path', () {
expect(
() => repo.createBlobFromDisk('invalid.file'),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"failed to resolve path 'invalid.file': No such file or directory",
),
),
throwsA(isA<LibGit2Error>()),
);
});