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

@ -49,13 +49,7 @@ void main() {
test('throws when trying to lookup and submodule not found', () {
expect(
() => repo.lookupSubmodule('not/there'),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"no submodule named 'not/there'",
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -81,13 +75,7 @@ void main() {
test('throws when trying to update not initialized submodule', () {
expect(
() => repo.updateSubmodule(submodule: testSubmodule),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"submodule is not initialized",
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -113,18 +101,7 @@ void main() {
test('throws when trying to open repository for not initialized submodule',
() {
final submodule = repo.lookupSubmodule(testSubmodule);
expect(
() => submodule.open(),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
contains("failed to resolve path"),
),
),
);
expect(() => submodule.open(), throwsA(isA<LibGit2Error>()));
submodule.free();
});
@ -149,14 +126,7 @@ void main() {
url: 'https://wrong.url/',
path: 'test',
),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
'failed to resolve address for wrong.url: Name or service '
'not known',
),
),
throwsA(isA<LibGit2Error>()),
);
});
@ -166,13 +136,7 @@ void main() {
url: 'https://wrong.url/',
path: 'test',
),
throwsA(
isA<LibGit2Error>().having(
(e) => e.toString(),
'error',
"invalid argument: 'repo'",
),
),
throwsA(isA<LibGit2Error>()),
);
});