Unverified Commit 436ca01e authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate features_tests and other tool tests to null safety (#80168)

parent e537661a
...@@ -101,7 +101,7 @@ define("$bootstrapModule", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) ...@@ -101,7 +101,7 @@ define("$bootstrapModule", ["$entrypoint", "dart_sdk"], function(app, dart_sdk)
String generateTestEntrypoint({ String generateTestEntrypoint({
required String relativeTestPath, required String relativeTestPath,
required String absolutePath, required String absolutePath,
required String testConfigPath, required String? testConfigPath,
required LanguageVersion languageVersion, required LanguageVersion languageVersion,
}) { }) {
return ''' return '''
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'package:flutter_tools/src/base/async_guard.dart'; import 'package:flutter_tools/src/base/async_guard.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/bot_detector.dart'; import 'package:flutter_tools/src/base/bot_detector.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
...@@ -19,9 +17,9 @@ final Uri azureUrl = Uri.parse('http://169.254.169.254/metadata/instance'); ...@@ -19,9 +17,9 @@ final Uri azureUrl = Uri.parse('http://169.254.169.254/metadata/instance');
void main() { void main() {
group('BotDetector', () { group('BotDetector', () {
FakePlatform fakePlatform; late FakePlatform fakePlatform;
FakeStdio fakeStdio; late FakeStdio fakeStdio;
PersistentToolState persistentToolState; late PersistentToolState persistentToolState;
setUp(() { setUp(() {
fakePlatform = FakePlatform()..environment = <String, String>{}; fakePlatform = FakePlatform()..environment = <String, String>{};
......
...@@ -2,20 +2,17 @@ ...@@ -2,20 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/command_help.dart'; import 'package:flutter_tools/src/base/command_help.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/terminal.dart' show AnsiTerminal, OutputPreferences; import 'package:flutter_tools/src/base/terminal.dart' show AnsiTerminal, OutputPreferences;
import 'package:meta/meta.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/fakes.dart'; import '../../src/fakes.dart';
CommandHelp _createCommandHelp({ CommandHelp _createCommandHelp({
@required bool ansi, required bool ansi,
@required int wrapColumn, required int wrapColumn,
}) { }) {
final Platform platform = FakePlatform( final Platform platform = FakePlatform(
stdoutSupportsAnsi: ansi, stdoutSupportsAnsi: ansi,
...@@ -36,9 +33,9 @@ CommandHelp _createCommandHelp({ ...@@ -36,9 +33,9 @@ CommandHelp _createCommandHelp({
// Used to use the message length in different scenarios in a DRY way // Used to use the message length in different scenarios in a DRY way
void _testMessageLength({ void _testMessageLength({
@required bool stdoutSupportsAnsi, required bool stdoutSupportsAnsi,
@required int maxTestLineLength, required int maxTestLineLength,
@required int wrapColumn, required int wrapColumn,
}) { }) {
final CommandHelp commandHelp = _createCommandHelp( final CommandHelp commandHelp = _createCommandHelp(
ansi: stdoutSupportsAnsi, ansi: stdoutSupportsAnsi,
...@@ -82,7 +79,7 @@ void main() { ...@@ -82,7 +79,7 @@ void main() {
group('toString', () { group('toString', () {
testWithoutContext('ends with a resetBold when it has parenthetical text', () { testWithoutContext('ends with a resetBold when it has parenthetical text', () {
final Platform platform = FakePlatform(stdoutSupportsAnsi: true); final Platform platform = FakePlatform(stdoutSupportsAnsi: true);
final AnsiTerminal terminal = AnsiTerminal(stdio: null, platform: platform); final AnsiTerminal terminal = AnsiTerminal(stdio: FakeStdio(), platform: platform);
final CommandHelpOption commandHelpOption = CommandHelpOption( final CommandHelpOption commandHelpOption = CommandHelpOption(
'tester', 'tester',
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/utils.dart'; import 'package:flutter_tools/src/base/utils.dart';
import '../src/common.dart'; import '../src/common.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/custom_devices/custom_device_workflow.dart'; import 'package:flutter_tools/src/custom_devices/custom_device_workflow.dart';
import '../../src/common.dart'; import '../../src/common.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/config.dart'; import 'package:flutter_tools/src/base/config.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
...@@ -14,16 +12,16 @@ import '../src/fakes.dart'; ...@@ -14,16 +12,16 @@ import '../src/fakes.dart';
void main() { void main() {
group('Features', () { group('Features', () {
Config testConfig; late Config testConfig;
FakePlatform platform; late FakePlatform platform;
FlutterFeatureFlags featureFlags; late FlutterFeatureFlags featureFlags;
setUp(() { setUp(() {
testConfig = Config.test(); testConfig = Config.test();
platform = FakePlatform(environment: <String, String>{}); platform = FakePlatform(environment: <String, String>{});
for (final Feature feature in allFeatures) { for (final Feature feature in allFeatures) {
testConfig.setValue(feature.configSetting, false); testConfig.setValue(feature.configSetting!, false);
} }
featureFlags = FlutterFeatureFlags( featureFlags = FlutterFeatureFlags(
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/linux/linux_workflow.dart'; import 'package:flutter_tools/src/linux/linux_workflow.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/web/bootstrap.dart'; import 'package:flutter_tools/src/web/bootstrap.dart';
import 'package:package_config/package_config.dart'; import 'package:package_config/package_config.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:convert'; import 'dart:convert';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
...@@ -30,9 +28,9 @@ void main() { ...@@ -30,9 +28,9 @@ void main() {
final WebMemoryFS webMemoryFS = WebMemoryFS(); final WebMemoryFS webMemoryFS = WebMemoryFS();
webMemoryFS.write(source, manifest, sourcemap, metadata); webMemoryFS.write(source, manifest, sourcemap, metadata);
expect(utf8.decode(webMemoryFS.files['foo.js']), 'main() {}'); expect(utf8.decode(webMemoryFS.files['foo.js']!), 'main() {}');
expect(utf8.decode(webMemoryFS.sourcemaps['foo.js.map']), '{}'); expect(utf8.decode(webMemoryFS.sourcemaps['foo.js.map']!), '{}');
expect(utf8.decode(webMemoryFS.metadataFiles['foo.js.metadata']), '{}'); expect(utf8.decode(webMemoryFS.metadataFiles['foo.js.metadata']!), '{}');
expect(webMemoryFS.mergedMetadata, '{}'); expect(webMemoryFS.mergedMetadata, '{}');
}); });
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/web/workflow.dart'; import 'package:flutter_tools/src/web/workflow.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/windows/windows_workflow.dart'; import 'package:flutter_tools/src/windows/windows_workflow.dart';
......
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