Unverified Commit 4453ba0a authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Null safety migration of packages/flutter_tools/test/general.shard, part 2/2 (#110712)

* Migrate packages/flutter_tools/test/general.shard, part 2/2

* Fix analysis

* Fix tests

* Fix analysis

* Apply suggestions from code review
Co-authored-by: 's avatarChristopher Fujino <fujino@google.com>
Co-authored-by: 's avatarChristopher Fujino <fujino@google.com>
parent 6c79dcca
......@@ -707,7 +707,7 @@ abstract class ResidentHandlers {
}
final List<FlutterView> views = await device!.vmService!.getFlutterViews();
for (final FlutterView view in views) {
final Map<String, Object>? rasterData =
final Map<String, Object?>? rasterData =
await device.vmService!.renderFrameWithRasterStats(
viewId: view.id,
uiIsolateId: view.uiIsolate!.id,
......
......@@ -557,7 +557,7 @@ class FlutterVmService {
/// for rasterization which is not reflective of how long the frame takes in
/// production. This is primarily intended to be used to identify the layers
/// that result in the most raster perf degradation.
Future<Map<String, Object>?> renderFrameWithRasterStats({
Future<Map<String, Object?>?> renderFrameWithRasterStats({
required String? viewId,
required String? uiIsolateId,
}) async {
......@@ -568,7 +568,7 @@ class FlutterVmService {
'viewId': viewId,
},
);
return response?.json as Map<String, Object>?;
return response?.json;
}
Future<String> flutterDebugDumpApp({
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:flutter_tools/executable.dart' as executable;
......@@ -111,7 +109,7 @@ void main() {
});
}
void verifyCommandRunner(CommandRunner<Object> runner) {
void verifyCommandRunner(CommandRunner<Object?> runner) {
expect(runner.argParser, isNotNull, reason: '${runner.runtimeType} has no argParser');
expect(runner.argParser.allowsAnything, isFalse, reason: '${runner.runtimeType} allows anything');
expect(runner.argParser.allowTrailingOptions, isFalse, reason: '${runner.runtimeType} allows trailing options');
......@@ -119,7 +117,7 @@ void verifyCommandRunner(CommandRunner<Object> runner) {
runner.commands.values.forEach(verifyCommand);
}
void verifyCommand(Command<Object> runner) {
void verifyCommand(Command<Object?> runner) {
expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser');
verifyOptions(runner.name, runner.argParser.options.values);
......@@ -161,7 +159,7 @@ const String _needHelp = "Every option must have help explaining what it does, e
const String _header = ' Comment: ';
void verifyOptions(String command, Iterable<Option> options) {
void verifyOptions(String? command, Iterable<Option> options) {
String target;
if (command == null) {
target = 'the global argument "';
......@@ -191,10 +189,11 @@ void verifyOptions(String command, Iterable<Option> options) {
if (option.defaultsTo != null) {
expect(option.help, isNot(contains('Default')), reason: '${_header}Help for $target--${option.name}" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).');
if (option.allowedHelp != null) {
for (final String allowedValue in option.allowedHelp.keys) {
final Map<String, String>? allowedHelp = option.allowedHelp;
if (allowedHelp != null) {
for (final String allowedValue in allowedHelp.keys) {
expect(
option.allowedHelp[allowedValue],
allowedHelp[allowedValue],
isNot(anyOf(contains('default'), contains('Default'))),
reason: '${_header}Help for $target--${option.name} $allowedValue" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).',
);
......@@ -202,7 +201,7 @@ void verifyOptions(String command, Iterable<Option> options) {
}
}
expect(option.help, isNot(matches(_bannedArgumentReferencePatterns)), reason: '${_header}Help for $target--${option.name}" contains the string "--" in an unexpected way. If it\'s trying to mention another argument, it should be quoted, as in "--foo".');
for (final String line in option.help.split('\n')) {
for (final String line in option.help!.split('\n')) {
if (!line.startsWith(' ')) {
expect(line, isNot(contains(' ')), reason: '${_header}Help for $target--${option.name}" has excessive whitespace (check e.g. for double spaces after periods or round line breaks in the source).');
expect(line, matches(_allowedTrailingPatterns), reason: '${_header}A line in the help for $target--${option.name}" does not end with the expected period that a full sentence should end with. (If the help ends with a URL, place it after a colon, don\'t leave a trailing period; if it\'s sample code, prefix the line with four spaces.)');
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart';
import 'package:file/memory.dart';
......@@ -45,10 +45,10 @@ const FakeCommand kListEmulatorsCommand = FakeCommand(
);
void main() {
FakeProcessManager fakeProcessManager;
FakeAndroidSdk sdk;
FileSystem fileSystem;
Xcode xcode;
late FakeProcessManager fakeProcessManager;
late FakeAndroidSdk sdk;
late FileSystem fileSystem;
late Xcode xcode;
setUp(() {
fileSystem = MemoryFileSystem.test();
......@@ -110,7 +110,16 @@ void main() {
});
testWithoutContext('getEmulatorsById', () async {
final TestEmulatorManager testEmulatorManager = TestEmulatorManager(emulators);
final TestEmulatorManager testEmulatorManager = TestEmulatorManager(emulators,
logger: BufferLogger.test(),
processManager: fakeProcessManager,
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
fileSystem: fileSystem,
);
expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5'), <Emulator>[emulator1]);
expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5X'), <Emulator>[emulator2]);
......@@ -340,7 +349,12 @@ void main() {
}
class TestEmulatorManager extends EmulatorManager {
TestEmulatorManager(this.allEmulators);
TestEmulatorManager(this.allEmulators, {
required super.logger,
required super.processManager,
required super.androidWorkflow,
required super.fileSystem,
});
final List<Emulator> allEmulators;
......@@ -374,16 +388,16 @@ class FakeEmulator extends Emulator {
class FakeAndroidSdk extends Fake implements AndroidSdk {
@override
String avdManagerPath;
String? avdManagerPath;
@override
String emulatorPath;
String? emulatorPath;
@override
String adbPath;
String? adbPath;
@override
String getAvdManagerPath() => avdManagerPath;
String? getAvdManagerPath() => avdManagerPath;
@override
String getAvdPath() => 'avd';
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:async';
import 'package:file/memory.dart';
......@@ -28,9 +26,9 @@ import '../src/context.dart';
import '../src/test_build_system.dart';
void main() {
FakeFlutterDevice mockFlutterDevice;
FakeWebDevFS mockWebDevFS;
FileSystem fileSystem;
late FakeFlutterDevice mockFlutterDevice;
late FakeWebDevFS mockWebDevFS;
late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
......@@ -191,22 +189,22 @@ class FakeWebDevice extends Fake implements Device {
@override
Future<bool> stopApp(
covariant ApplicationPackage app, {
String userIdentifier,
covariant ApplicationPackage? app, {
String? userIdentifier,
}) async {
return true;
}
@override
Future<LaunchResult> startApp(
covariant ApplicationPackage package, {
String mainPath,
String route,
DebuggingOptions debuggingOptions,
Map<String, dynamic> platformArgs,
covariant ApplicationPackage? package, {
String? mainPath,
String? route,
DebuggingOptions? debuggingOptions,
Map<String, dynamic>? platformArgs,
bool prebuiltApplication = false,
bool ipv6 = false,
String userIdentifier,
String? userIdentifier,
}) async {
return LaunchResult.succeeded();
}
......@@ -219,14 +217,14 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
final FakeWebDevice device;
DevFS _devFS;
DevFS? _devFS;
@override
DevFS get devFS => _devFS;
DevFS? get devFS => _devFS;
@override
set devFS(DevFS value) { }
set devFS(DevFS? value) { }
@override
FlutterVmService vmService;
FlutterVmService? vmService;
}
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:async';
import 'package:fake_async/fake_async.dart';
......@@ -62,7 +60,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
void main() {
testWithoutContext('VmService registers reloadSources', () async {
Future<void> reloadSources(String isolateId, { bool pause, bool force}) async {}
Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {}
final MockVMService mockVMService = MockVMService();
await setUpVmService(
......@@ -217,7 +215,7 @@ void main() {
windows: false,
));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>;
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
......@@ -245,7 +243,7 @@ void main() {
windows: true,
));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>;
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
......@@ -269,7 +267,7 @@ void main() {
viewId: 'abc',
));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>;
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kGetSkSLsMethod),
......@@ -291,7 +289,7 @@ void main() {
uiIsolateId: 'def',
));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>;
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kFlushUIThreadTasksMethod),
......@@ -469,7 +467,7 @@ void main() {
]
);
final Map<String, Object> skSLs = await fakeVmServiceHost.vmService.getSkSLs(
final Map<String, Object?>? skSLs = await fakeVmServiceHost.vmService.getSkSLs(
viewId: '1234',
);
expect(skSLs, isNull);
......@@ -477,19 +475,19 @@ void main() {
final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews();
expect(views, isEmpty);
final vm_service.Response screenshot = await fakeVmServiceHost.vmService.screenshot();
final vm_service.Response? screenshot = await fakeVmServiceHost.vmService.screenshot();
expect(screenshot, isNull);
final vm_service.Response screenshotSkp = await fakeVmServiceHost.vmService.screenshotSkp();
final vm_service.Response? screenshotSkp = await fakeVmServiceHost.vmService.screenshotSkp();
expect(screenshotSkp, isNull);
// Checking that this doesn't throw.
await fakeVmServiceHost.vmService.setTimelineFlags(<String>['test']);
final vm_service.Response timeline = await fakeVmServiceHost.vmService.getTimeline();
final vm_service.Response? timeline = await fakeVmServiceHost.vmService.getTimeline();
expect(timeline, isNull);
final Map<String, Object> rasterStats =
final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: '1', uiIsolateId: '12');
expect(rasterStats, isNull);
......@@ -505,7 +503,7 @@ void main() {
]
);
final vm_service.Isolate isolate = await fakeVmServiceHost.vmService.getIsolateOrNull(
final vm_service.Isolate? isolate = await fakeVmServiceHost.vmService.getIsolateOrNull(
'isolate/123',
);
expect(isolate, null);
......@@ -535,7 +533,7 @@ void main() {
]
);
final Map<String, Object> rasterStats =
final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: 'view/1', uiIsolateId: 'isolate/123');
expect(rasterStats, equals(response));
......@@ -629,7 +627,7 @@ void main() {
isolate.toJson()
..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName],
);
)!;
final FlutterView fakeFlutterView2 = FlutterView(
id: '2',
......@@ -680,7 +678,7 @@ void main() {
testWithoutContext('does not rethrow a sentinel exception if the initially queried flutter view disappears', () async {
const String otherExtensionName = 'ext.flutter.test.otherExtension';
final vm_service.Isolate isolate2 = vm_service.Isolate.parse(
final vm_service.Isolate? isolate2 = vm_service.Isolate.parse(
isolate.toJson()
..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName],
......@@ -836,7 +834,7 @@ void main() {
testUsingContext('WebSocket URL construction uses correct URI join primitives', () async {
final Completer<String> completer = Completer<String>();
openChannelForTesting = (String url, {io.CompressionOptions compression, Logger logger}) async {
openChannelForTesting = (String url, {io.CompressionOptions compression = io.CompressionOptions.compressionDefault, required Logger logger}) async {
completer.complete(url);
throw Exception('');
};
......@@ -883,8 +881,8 @@ class FakeDevice extends Fake implements Device { }
/// A [WebSocketConnector] that always throws an [io.SocketException].
Future<io.WebSocket> failingWebSocketConnector(
String url, {
io.CompressionOptions compression,
Logger logger,
io.CompressionOptions? compression,
Logger? logger,
}) {
throw const io.SocketException('Failed WebSocket connection');
}
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:async';
import 'dart:io' hide Directory, File;
......@@ -23,7 +21,6 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/isolated/devfs_web.dart';
import 'package:flutter_tools/src/web/compile.dart';
import 'package:logging/logging.dart' as logging;
import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart';
import 'package:shelf/shelf.dart';
import 'package:test/fake.dart';
......@@ -41,14 +38,14 @@ const List<int> kTransparentImage = <int>[
];
void main() {
Testbed testbed;
WebAssetServer webAssetServer;
ReleaseAssetServer releaseAssetServer;
Platform linux;
PackageConfig packages;
Platform windows;
FakeHttpServer httpServer;
BufferLogger logger;
late Testbed testbed;
late WebAssetServer webAssetServer;
late ReleaseAssetServer releaseAssetServer;
late Platform linux;
late PackageConfig packages;
late Platform windows;
late FakeHttpServer httpServer;
late BufferLogger logger;
setUpAll(() async {
packages = PackageConfig(<Package>[
......@@ -66,15 +63,15 @@ void main() {
httpServer,
packages,
InternetAddress.loopbackIPv4,
null,
null,
null,
<String, String>{},
<String, String>{},
NullSafetyMode.unsound,
);
releaseAssetServer = ReleaseAssetServer(
globals.fs.file('main.dart').uri,
fileSystem: null, // ignore: avoid_redundant_argument_values
fileSystem: globals.fs,
flutterRoot: null, // ignore: avoid_redundant_argument_values
platform: null, // ignore: avoid_redundant_argument_values
platform: FakePlatform(),
webBuildDirectory: null, // ignore: avoid_redundant_argument_values
basePath: null,
);
......@@ -183,10 +180,10 @@ void main() {
}));
webAssetServer.write(source, manifest, sourcemap, metadata);
final String merged = await webAssetServer.metadataContents('main_module.ddc_merged_metadata');
final String? merged = await webAssetServer.metadataContents('main_module.ddc_merged_metadata');
expect(merged, equals(metadataContents));
final String single = await webAssetServer.metadataContents('foo.js.metadata');
final String? single = await webAssetServer.metadataContents('foo.js.metadata');
expect(single, equals(metadataContents));
}, overrides: <Type, Generator>{
Platform: () => linux,
......@@ -292,9 +289,9 @@ void main() {
httpServer,
packages,
InternetAddress.loopbackIPv4,
null,
null,
null,
<String, String>{},
<String, String>{},
NullSafetyMode.unsound,
);
expect(webAssetServer.basePath, 'foo/bar');
......@@ -311,9 +308,9 @@ void main() {
httpServer,
packages,
InternetAddress.loopbackIPv4,
null,
null,
null,
<String, String>{},
<String, String>{},
NullSafetyMode.unsound,
);
// Defaults to "/" when there's no base element.
......@@ -332,9 +329,9 @@ void main() {
httpServer,
packages,
InternetAddress.loopbackIPv4,
null,
null,
null,
<String, String>{},
<String, String>{},
NullSafetyMode.unsound,
),
throwsToolExit(),
);
......@@ -352,9 +349,9 @@ void main() {
httpServer,
packages,
InternetAddress.loopbackIPv4,
null,
null,
null,
<String, String>{},
<String, String>{},
NullSafetyMode.unsound,
),
throwsToolExit(),
);
......@@ -380,7 +377,7 @@ void main() {
final Response response = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/foo.js')));
final String etag = response.headers[HttpHeaders.etagHeader];
final String etag = response.headers[HttpHeaders.etagHeader]!;
final Response cachedResponse = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/foo.js'), headers: <String, String>{
......@@ -622,14 +619,14 @@ void main() {
final Response response = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/assets/fooπ')));
final String etag = response.headers[HttpHeaders.etagHeader];
final String etag = response.headers[HttpHeaders.etagHeader]!;
expect(etag.runes, everyElement(predicate((int char) => char < 255)));
}));
test('serves /packages/<package>/<path> files as if they were '
'package:<package>/<path> uris', () => testbed.run(() async {
final Uri expectedUri = packages.resolve(
final Uri? expectedUri = packages.resolve(
Uri.parse('package:flutter_tools/foo.dart'));
final File source = globals.fs.file(globals.fs.path.fromUri(expectedUri))
..createSync(recursive: true)
......@@ -691,13 +688,13 @@ void main() {
final Uri uri = await webDevFS.create();
webDevFS.webAssetServer.entrypointCacheDirectory = globals.fs.currentDirectory;
final String webPrecompiledSdk = globals.artifacts
final String webPrecompiledSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSdk).path;
final String webPrecompiledSdkSourcemaps = globals.artifacts
final String webPrecompiledSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSdkSourcemaps).path;
final String webPrecompiledCanvaskitSdk = globals.artifacts
final String webPrecompiledCanvaskitSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdk).path;
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdkSourcemaps).path;
globals.fs.currentDirectory
.childDirectory('lib')
......@@ -808,13 +805,13 @@ void main() {
.childFile('web_entrypoint.dart')
..createSync(recursive: true)
..writeAsStringSync('GENERATED');
final String webPrecompiledSdk = globals.artifacts
final String webPrecompiledSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path;
final String webPrecompiledSdkSourcemaps = globals.artifacts
final String webPrecompiledSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSoundSdkSourcemaps).path;
final String webPrecompiledCanvaskitSdk = globals.artifacts
final String webPrecompiledCanvaskitSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdk).path;
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps).path;
globals.fs.file(webPrecompiledSdk)
..createSync(recursive: true)
......@@ -917,7 +914,7 @@ void main() {
webDevFS.webAssetServer.dwds = FakeDwds(<AppConnection>[firstConnection, secondConnection]);
int vmServiceFactoryInvocationCount = 0;
Future<vm_service.VmService> vmServiceFactory(Uri uri, {CompressionOptions compression, @required Logger logger}) {
Future<vm_service.VmService> vmServiceFactory(Uri uri, {CompressionOptions? compression, required Logger logger}) {
if (vmServiceFactoryInvocationCount > 0) {
fail('Called vmServiceFactory twice!');
}
......@@ -927,7 +924,7 @@ void main() {
() => FakeVmService(),
);
}
return webDevFS.connect(false, vmServiceFactory: vmServiceFactory).then<void>((ConnectionResult firstConnectionResult) {
return webDevFS.connect(false, vmServiceFactory: vmServiceFactory).then<void>((ConnectionResult? firstConnectionResult) {
return webDevFS.destroy();
});
});
......@@ -1078,7 +1075,7 @@ void main() {
false,
Uri.base,
null,
null,
NullSafetyMode.unsound,
testMode: true);
expect(webAssetServer.defaultResponseHeaders['x-frame-options'], null);
......@@ -1179,20 +1176,20 @@ class FakeHttpServer extends Fake implements HttpServer {
}
class FakeResidentCompiler extends Fake implements ResidentCompiler {
CompilerOutput output;
CompilerOutput? output;
@override
void addFileSystemRoot(String root) { }
@override
Future<CompilerOutput> recompile(Uri mainUri, List<Uri> invalidatedFiles, {
String outputPath,
PackageConfig packageConfig,
String projectRootPath,
FileSystem fs,
Future<CompilerOutput?> recompile(Uri mainUri, List<Uri>? invalidatedFiles, {
String? outputPath,
PackageConfig? packageConfig,
String? projectRootPath,
FileSystem? fs,
bool suppressErrors = false,
bool checkDartPluginRegistry = false,
File dartPluginRegistrant,
File? dartPluginRegistrant,
}) async {
return output;
}
......@@ -1202,7 +1199,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler {
const FakeShaderCompiler();
@override
void configureCompiler(TargetPlatform platform, { @required bool enableImpeller }) { }
void configureCompiler(TargetPlatform? platform, { required bool enableImpeller }) { }
@override
Future<DevFSContent> recompileShader(DevFSContent inputShader) {
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:convert';
import 'package:flutter_tools/src/base/file_system.dart';
......@@ -16,11 +14,11 @@ import '../../src/fakes.dart';
void main() {
group('Test that TestGoldenComparatorProcess', () {
File imageFile;
Uri goldenKey;
File imageFile2;
Uri goldenKey2;
FakeProcess Function(String) createFakeProcess;
late File imageFile;
late Uri goldenKey;
late File imageFile2;
late Uri goldenKey2;
late FakeProcess Function(String) createFakeProcess;
setUpAll(() {
imageFile = globals.fs.file('test_image_file');
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
......@@ -22,13 +20,13 @@ void main() {
group('ScrubGeneratedPluginRegistrant', () {
// The files this migration deals with
File gitignore;
File registrant;
late File gitignore;
late File registrant;
// Environment overrides
FileSystem fileSystem;
ProcessManager processManager;
BuildSystem buildSystem;
late FileSystem fileSystem;
late ProcessManager processManager;
late BuildSystem buildSystem;
setUp(() {
// Prepare environment overrides
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
......@@ -28,7 +26,7 @@ final Platform platform = FakePlatform(
);
void main() {
FileSystem fileSystem;
late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:dwds/dwds.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
......@@ -14,7 +12,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart';
void main() {
FileSystem fileSystem;
late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
......@@ -27,7 +25,7 @@ void main() {
final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, null);
'', '', 1, 1, <String, String>{}, <String, String>{}, '', '');
expectResult(result, false, 'a');
});
......@@ -39,7 +37,7 @@ void main() {
final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, null);
'', '', 1, 1, <String, String>{}, <String, String>{}, '', '');
expectResult(result, true, 'Error: a');
});
......@@ -50,7 +48,7 @@ void main() {
final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, 'a');
'', '', 1, 1, <String, String>{}, <String, String>{}, '', 'a');
expectResult(result, true, "InternalError: frontend server failed to compile 'a'");
});
......@@ -66,10 +64,10 @@ void expectResult(ExpressionCompilationResult result, bool isError, String value
class FakeResidentCompiler extends Fake implements ResidentCompiler {
FakeResidentCompiler(this.output);
final CompilerOutput output;
final CompilerOutput? output;
@override
Future<CompilerOutput> compileExpressionToJs(
Future<CompilerOutput?> compileExpressionToJs(
String libraryUri,
int line,
int column,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment