Skip to content

Commit 6fe246a

Browse files
committed
random cleanup
1 parent b1b2c02 commit 6fe246a

File tree

13 files changed

+29
-28
lines changed

13 files changed

+29
-28
lines changed

pkgs/checks/lib/src/checks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ extension ContextExtension<T> on Subject<T> {
225225
/// specific signature varies by operation.
226226
///
227227
///
228-
/// In expectation extension methods calling [expect], [expectAync], or
228+
/// In expectation extension methods calling [expect], [expectAsync], or
229229
/// [expectUnawaited], the `predicate` callback can report a [Rejection] if the
230230
/// value fails to satisfy the expectation.
231231
/// The description will be passed in a "clause" callback.

pkgs/checks/lib/src/extensions/iterable.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extension IterableChecks<T> on Subject<Iterable<T>> {
7070
}
7171

7272
/// Expects that the iterable contains a value matching each expected value
73-
/// from [elelements] in the given order, with any extra elements between
73+
/// from [elements] in the given order, with any extra elements between
7474
/// them.
7575
///
7676
/// For example, the following will succeed:

pkgs/checks/test/extensions/async_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fake trace''');
240240
queue,
241241
(Subject<StreamQueue<int>> it) =>
242242
it.emitsThrough((it) => it.equals(42)));
243-
check(queue).emits((it) => it.equals(0));
243+
await check(queue).emits((it) => it.equals(0));
244244
});
245245
test('consumes events', () async {
246246
final queue = _countingStream(3);

pkgs/checks/test/soft_check_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void main() {
1919
});
2020
group('softCheckAsync', () {
2121
test('returns the first failure', () async {
22-
check(Future.value(0)).isRejectedByAsync(
22+
await check(Future.value(0)).isRejectedByAsync(
2323
(it) => it
2424
..completes((it) => it.isGreaterThan(1))
2525
..completes((it) => it.isGreaterThan(2)),

pkgs/test_core/lib/src/bootstrap/vm.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'dart:async';
56
import 'dart:developer';
67
import 'dart:io';
78
import 'dart:isolate';
@@ -41,9 +42,9 @@ void internalBootstrapNativeTest(
4142
..pipe(serializeSuite(getMain));
4243
platformChannel.sink.add(testControlChannel.id);
4344

44-
platformChannel.stream.forEach((message) {
45+
unawaited(platformChannel.stream.forEach((message) {
4546
assert(message == 'debug');
4647
debugger(message: 'Paused by test runner');
4748
platformChannel.sink.add('done');
48-
});
49+
}));
4950
}

pkgs/test_core/lib/src/runner/console.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class _Command {
111111
final String description;
112112

113113
/// The callback to run when the command is invoked.
114-
final Function body;
114+
final dynamic Function() body;
115115

116116
_Command(this.name, this.description, this.body);
117117
}

pkgs/test_core/lib/src/runner/engine.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ class Engine {
387387
await Future(() {});
388388

389389
if (!_restarted.contains(liveTest)) {
390-
if (_stopOnFirstFailure && liveTest.state.result.isFailing) close();
390+
if (_stopOnFirstFailure && liveTest.state.result.isFailing) {
391+
unawaited(close());
392+
}
391393
return;
392394
}
393395
await _runLiveTest(suiteController, liveTest.copy(),

pkgs/test_core/lib/src/runner/load_suite.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:test_api/src/backend/suite.dart'; // ignore: implementation_impo
1414
import 'package:test_api/src/backend/suite_platform.dart'; // ignore: implementation_imports
1515
import 'package:test_api/src/backend/test.dart'; // ignore: implementation_imports
1616

17-
import '../util/async.dart';
1817
import '../util/io_stub.dart' if (dart.library.io) '../util/io.dart';
1918
import '../util/pair.dart';
2019
import 'load_exception.dart';

pkgs/test_core/lib/src/runner/runner_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,24 @@ class RunnerTest extends Test {
4343
_channel.sink.add({'command': 'run', 'channel': testChannel.id});
4444

4545
testChannel.stream.listen((message) {
46-
switch (message['type'] as String) {
46+
final msg = message as Map;
47+
switch (msg['type'] as String) {
4748
case 'error':
4849
var asyncError = RemoteException.deserialize(
49-
message['error'] as Map<String, dynamic>);
50+
msg['error'] as Map<String, dynamic>);
5051
var stackTrace = asyncError.stackTrace;
5152
controller.addError(asyncError.error, stackTrace);
5253
break;
5354

5455
case 'state-change':
55-
controller.setState(State(Status.parse(message['status'] as String),
56-
Result.parse(message['result'] as String)));
56+
controller.setState(State(Status.parse(msg['status'] as String),
57+
Result.parse(msg['result'] as String)));
5758
break;
5859

5960
case 'message':
6061
controller.message(Message(
61-
MessageType.parse(message['message-type'] as String),
62-
message['text'] as String));
62+
MessageType.parse(msg['message-type'] as String),
63+
msg['text'] as String));
6364
break;
6465

6566
case 'complete':
@@ -70,9 +71,8 @@ class RunnerTest extends Test {
7071
// When we kill the isolate that the test lives in, that will close
7172
// this virtual channel and cause the spawned isolate to close as
7273
// well.
73-
spawnHybridUri(message['url'] as String, message['message'], suite)
74-
.pipe(testChannel
75-
.virtualChannel((message['channel'] as num).toInt()));
74+
spawnHybridUri(msg['url'] as String, msg['message'], suite).pipe(
75+
testChannel.virtualChannel((msg['channel'] as num).toInt()));
7676
break;
7777
}
7878
}, onDone: () {

pkgs/test_core/lib/src/runner/vm/platform.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class VMPlatform extends PlatformPlugin {
5959
process =
6060
await _spawnExecutable(path, suiteConfig.metadata, serverSocket);
6161
} catch (error) {
62-
serverSocket.close();
62+
unawaited(serverSocket.close());
6363
rethrow;
6464
}
6565
process.stdout.listen(stdout.add);
@@ -100,8 +100,8 @@ class VMPlatform extends PlatformPlugin {
100100
for (var fn in cleanupCallbacks) {
101101
fn();
102102
}
103-
eventSub?.cancel();
104-
client?.dispose();
103+
unawaited(eventSub?.cancel());
104+
unawaited(client?.dispose());
105105
sink.close();
106106
}));
107107

0 commit comments

Comments
 (0)