Skip to content

Commit c6fedad

Browse files
Fix test coverage issues
1 parent b81aec2 commit c6fedad

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/async_lock.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ class AsyncLock<T> {
4444
return result;
4545
// ignore: avoid_catches_without_on_clauses
4646
} catch (error, stackTrace) {
47+
// coverage:ignore-start
48+
//This is only here for some potential future use cases
4749
if (retainFutureErrors) {
4850
_completer!.completeError(error, stackTrace);
51+
// coverage:ignore-end
4952
} else {
5053
_completer = null;
5154
}
55+
5256
rethrow;
5357
}
5458
}

test/ioc_container_test.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,22 @@ void main() {
329329
test('Test Not Found', () {
330330
final container = IocContainerBuilder().toContainer();
331331
expect(
332+
() async => container.getAsync<A>(),
333+
throwsA(
334+
predicate(
335+
(exception) =>
336+
exception is ServiceNotFoundException<A> &&
337+
exception.message == 'Service A not found' &&
338+
exception.toString() ==
339+
'ServiceNotFoundException: Service A not found',
340+
),
341+
),
342+
);
343+
});
344+
345+
test('Test Not Found Async', () async {
346+
final container = IocContainerBuilder().toContainer();
347+
await expectLater(
332348
() => container.get<A>(),
333349
throwsA(
334350
predicate(
@@ -572,7 +588,7 @@ void main() {
572588
try {
573589
//This allows cleanup, but this also causes the same effect as
574590
//expectLater or awaiting the future in the try block
575-
//All the versions are different flavors of the same time, and
591+
//All the versions are different flavors of the same time, and
576592
//perhaps there is no way to use expect with a future without
577593
//causing a deadlock
578594
await future;
@@ -634,7 +650,8 @@ void main() {
634650
);
635651
});
636652

637-
test('Test Async Singleton Recovers From Error v3 - Full Try/Catch', () async {
653+
test('Test Async Singleton Recovers From Error v3 - Full Try/Catch',
654+
() async {
638655
var throwException = true;
639656

640657
final builder = IocContainerBuilder()

0 commit comments

Comments
 (0)