From a8f200928c60a002d1d3d3218fd1906c914d41cd Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 23 May 2019 11:08:58 -0700 Subject: [PATCH 1/2] Fix missing_return violation newly enforced in Dart ~2.3.2-dev.0.1 --- test/async_cache_test.dart | 6 +++--- test/cancelable_operation_test.dart | 6 +++--- test/stream_queue_test.dart | 1 + test/subscription_transformer_test.dart | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/async_cache_test.dart b/test/async_cache_test.dart index 92e34bf..5474a37 100644 --- a/test/async_cache_test.dart +++ b/test/async_cache_test.dart @@ -22,7 +22,7 @@ void main() { test('should not fetch via callback when a cache exists', () async { await cache.fetch(() async => 'Expensive'); - expect(await cache.fetch(expectAsync0(() {}, count: 0)), 'Expensive'); + expect(await cache.fetch(expectAsync0(() => null, count: 0)), 'Expensive'); }); test('should not fetch via callback when a future is in-flight', () async { @@ -31,7 +31,7 @@ void main() { var completer = Completer(); expect(cache.fetch(() => completer.future), completion('Expensive')); - expect(cache.fetch(expectAsync0(() {}, count: 0)), completion('Expensive')); + expect(cache.fetch(expectAsync0(() => null, count: 0)), completion('Expensive')); completer.complete('Expensive'); }); @@ -78,7 +78,7 @@ void main() { yield '2'; yield '3'; }).toList(); - expect(await cache.fetchStream(expectAsync0(() {}, count: 0)).toList(), + expect(await cache.fetchStream(expectAsync0(() => null, count: 0)).toList(), ['1', '2', '3']); }); diff --git a/test/cancelable_operation_test.dart b/test/cancelable_operation_test.dart index a4c9308..a47e952 100644 --- a/test/cancelable_operation_test.dart +++ b/test/cancelable_operation_test.dart @@ -251,9 +251,9 @@ void main() { setUp(() { // Initialize all functions to ones that expect to not be called. - onValue = expectAsync1((_) {}, count: 0, id: "onValue"); - onError = expectAsync2((e, s) {}, count: 0, id: "onError"); - onCancel = expectAsync0(() {}, count: 0, id: "onCancel"); + onValue = expectAsync1((_) => null, count: 0, id: "onValue"); + onError = expectAsync2((e, s) => null, count: 0, id: "onError"); + onCancel = expectAsync0(() => null, count: 0, id: "onCancel"); propagateCancel = false; }); diff --git a/test/stream_queue_test.dart b/test/stream_queue_test.dart index aaf1227..b2a8625 100644 --- a/test/stream_queue_test.dart +++ b/test/stream_queue_test.dart @@ -254,6 +254,7 @@ main() { expect(value, expectedValue); expect(index, sequenceIndex); index++; + return null; }; await Future.wait([ skip1.then(sequence(0, 0)), diff --git a/test/subscription_transformer_test.dart b/test/subscription_transformer_test.dart index 2a709a4..64f45ec 100644 --- a/test/subscription_transformer_test.dart +++ b/test/subscription_transformer_test.dart @@ -90,6 +90,7 @@ void main() { subscriptionTransformer(handleCancel: expectAsync1((inner) { callbackInvoked = true; inner.cancel(); + return null; }))).listen(expectAsync1((_) {}, count: 0)); await flushMicrotasks(); @@ -251,7 +252,7 @@ void main() { setUp(() { var controller = StreamController(); subscription = controller.stream - .transform(subscriptionTransformer(handleCancel: (_) {})) + .transform(subscriptionTransformer(handleCancel: (_) => null)) .listen(expectAsync1((_) {}, count: 0), onError: expectAsync2((_, __) {}, count: 0), onDone: expectAsync0(() {}, count: 0)); From 326f1b2f3ddf28062faed3d3d9a6bc3cb47a3c36 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 23 May 2019 12:47:08 -0700 Subject: [PATCH 2/2] fmt --- test/async_cache_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/async_cache_test.dart b/test/async_cache_test.dart index 5474a37..b7f7b8e 100644 --- a/test/async_cache_test.dart +++ b/test/async_cache_test.dart @@ -31,7 +31,8 @@ void main() { var completer = Completer(); expect(cache.fetch(() => completer.future), completion('Expensive')); - expect(cache.fetch(expectAsync0(() => null, count: 0)), completion('Expensive')); + expect(cache.fetch(expectAsync0(() => null, count: 0)), + completion('Expensive')); completer.complete('Expensive'); });