Skip to content

Commit 098a25a

Browse files
authored
Migrate a handful of tests to null-safety (#1713)
1 parent fd2a985 commit 098a25a

8 files changed

+12
-28
lines changed

dwds/test/dart_uri_file_uri_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
@TestOn('vm')
86
import 'dart:io';
97

dwds/test/debug_extension_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
// When run locally this test may require a manifest key. This makes it easy to
86
// just skip it.
97
@Tags(['extension'])
@@ -242,7 +240,7 @@ void main() async {
242240
'http://localhost:${context.port}/hello_world/main.dart$bootstrapJsExtension'));
243241
expect(result.body.contains('dartExtensionUri'), isTrue);
244242
final extensionUri =
245-
Uri.parse(uriPattern.firstMatch(result.body).group(1));
243+
Uri.parse(uriPattern.firstMatch(result.body)!.group(1)!);
246244
expect(
247245
extensionUri.host,
248246
anyOf(

dwds/test/debug_service_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
@TestOn('vm')
86
import 'dart:async';
97
import 'dart:convert';

dwds/test/devtools_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
@Timeout(Duration(minutes: 5))
86
@TestOn('vm')
97
import 'dart:io';

dwds/test/listviews_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
import 'package:test/test.dart';
86

97
import 'fixtures/context.dart';
@@ -23,12 +21,12 @@ void main() {
2321
final serviceMethod = '_flutter.listViews';
2422
final service = context.debugConnection.vmService;
2523
final vm = await service.getVM();
26-
final isolates = vm.isolates;
24+
final isolates = vm.isolates!;
2725

2826
final expected = <String, Object>{
2927
'views': <Object>[
3028
for (var isolate in isolates)
31-
<String, Object>{
29+
<String, Object?>{
3230
'id': isolate.id,
3331
'isolate': isolate.toJson(),
3432
}

dwds/test/readers/proxy_server_asset_reader_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
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-
// @dart = 2.9
6-
75
import 'package:dwds/src/readers/proxy_server_asset_reader.dart';
86
import 'package:test/test.dart';
97

108
import '../fixtures/context.dart';
119

1210
void main() {
1311
final context = TestContext();
14-
ProxyServerAssetReader assetReader;
12+
late ProxyServerAssetReader assetReader;
1513
setUpAll(() async {
1614
await context.setUp();
1715
assetReader = context.testServer.assetReader as ProxyServerAssetReader;

dwds/test/refresh_test.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
/// Tests that require a fresh context to run, and can interfere with other
86
/// tests.
97
@TestOn('vm')
@@ -26,7 +24,7 @@ WipConnection get tabConnection => context.tabConnection;
2624

2725
void main() {
2826
group('fresh context', () {
29-
VM vm;
27+
late VM vm;
3028
setUpAll(() async {
3129
await context.setUp();
3230
vm = await service.getVM();
@@ -48,18 +46,18 @@ void main() {
4846
// Wait for the refresh to propagate through.
4947
final isolateStart =
5048
await stream.firstWhere((e) => e.kind != EventKind.kIsolateStart);
51-
final isolateId = isolateStart.isolate.id;
49+
final isolateId = isolateStart.isolate!.id!;
5250
final refreshedScriptList = await service.getScripts(isolateId);
53-
final refreshedMain = refreshedScriptList.scripts
54-
.lastWhere((each) => each.uri.contains('main.dart'));
51+
final refreshedMain = refreshedScriptList.scripts!
52+
.lastWhere((each) => each.uri!.contains('main.dart'));
5553
final bpLine = await context.findBreakpointLine(
5654
'printHelloWorld', isolateId, refreshedMain);
5755
final bp =
58-
await service.addBreakpoint(isolateId, refreshedMain.id, bpLine);
59-
final isolate = await service.getIsolate(vm.isolates.first.id);
56+
await service.addBreakpoint(isolateId, refreshedMain.id!, bpLine);
57+
final isolate = await service.getIsolate(vm.isolates!.first.id!);
6058
expect(isolate.breakpoints, [bp]);
6159
expect(bp.id, isNotNull);
62-
await service.removeBreakpoint(isolateId, bp.id);
60+
await service.removeBreakpoint(isolateId, bp.id!);
6361
expect(isolate.breakpoints, isEmpty);
6462
});
6563
});

dwds/test/screenshot_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
// @dart = 2.9
6-
75
import 'package:test/test.dart';
86

97
import 'fixtures/context.dart';
@@ -22,6 +20,6 @@ void main() {
2220
test('can take screenshots', () async {
2321
final response = await context.debugConnection.vmService
2422
.callServiceExtension('ext.dwds.screenshot');
25-
expect(response.json['data'], isNotNull);
23+
expect(response.json!['data'], isNotNull);
2624
});
2725
}

0 commit comments

Comments
 (0)