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

@ -45,13 +45,7 @@ void main() {
test('throws when trying to initialize and error occurs', () {
expect(
() => TreeBuilder(repo: Repository(nullptr)),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"invalid argument: 'repo'",
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -91,13 +85,7 @@ void main() {
oid: repo['0' * 40],
filemode: GitFilemode.blob,
),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"failed to insert entry: invalid name for a tree entry - ",
),
),
throwsA(isA<LibGit2Error>()),
);
expect(
() => builder.add(
@ -105,13 +93,7 @@ void main() {
oid: repo['0' * 40],
filemode: GitFilemode.blob,
),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"failed to insert entry: invalid null OID - some.file",
),
),
throwsA(isA<LibGit2Error>()),
);
builder.free();
@ -131,18 +113,7 @@ void main() {
test('throws when trying to remove entry that is not in the tree', () {
final builder = TreeBuilder(repo: repo);
expect(
() => builder.remove('not.there'),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"failed to remove entry: file isn't in the tree - not.there",
),
),
);
expect(() => builder.remove('not.there'), throwsA(isA<LibGit2Error>()));
builder.free();
});
});