feat: migrate test_data/project.dart to null safety (#92646)
This commit is contained in:
parent
125545da32
commit
bd935e5d4f
@ -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
|
||||
|
||||
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
|
||||
// dependencies have been fixed.
|
||||
// https://github.com/flutter/flutter/issues/85160
|
||||
@ -18,7 +16,7 @@ import 'test_driver.dart';
|
||||
import 'test_utils.dart';
|
||||
|
||||
void main() {
|
||||
Directory tempDir;
|
||||
late Directory tempDir;
|
||||
|
||||
setUp(() async {
|
||||
tempDir = createResolvedTempDirectorySync('break_on_framework_exceptions.');
|
||||
@ -43,7 +41,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'AnimationController listener';"));
|
||||
});
|
||||
|
||||
@ -62,7 +60,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'AnimationController status listener';"));
|
||||
});
|
||||
|
||||
@ -81,7 +79,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'ValueNotifier listener';"));
|
||||
});
|
||||
|
||||
@ -108,7 +106,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'while handling a gesture';"));
|
||||
});
|
||||
|
||||
@ -126,7 +124,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'platform message callback';"));
|
||||
});
|
||||
|
||||
@ -147,7 +145,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'cannot build child';"));
|
||||
});
|
||||
|
||||
@ -171,7 +169,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'onChanged';"));
|
||||
});
|
||||
|
||||
@ -197,7 +195,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'onEditingComplete';"));
|
||||
});
|
||||
|
||||
@ -219,7 +217,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'onSelectionChanged';"));
|
||||
});
|
||||
|
||||
@ -238,7 +236,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'action listener';"));
|
||||
});
|
||||
|
||||
@ -257,7 +255,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'pointer route';"));
|
||||
});
|
||||
|
||||
@ -277,7 +275,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'PointerSignalResolver callback';"));
|
||||
});
|
||||
|
||||
@ -297,7 +295,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'highlight mode listener';"));
|
||||
});
|
||||
|
||||
@ -324,7 +322,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'onHover';"));
|
||||
});
|
||||
|
||||
@ -350,7 +348,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'setImage';"));
|
||||
});
|
||||
|
||||
@ -373,7 +371,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'onError';"));
|
||||
});
|
||||
|
||||
@ -392,7 +390,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'LayoutBuilder.builder';"));
|
||||
});
|
||||
|
||||
@ -411,7 +409,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw '_CallbackHookProvider.callback';"));
|
||||
});
|
||||
|
||||
@ -429,7 +427,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'TimingsCallback';"));
|
||||
});
|
||||
|
||||
@ -450,7 +448,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'scheduled task';"));
|
||||
});
|
||||
|
||||
@ -468,7 +466,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'FrameCallback';"));
|
||||
});
|
||||
|
||||
@ -494,7 +492,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'create element';"));
|
||||
});
|
||||
|
||||
@ -517,7 +515,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'performLayout';"));
|
||||
});
|
||||
|
||||
@ -543,7 +541,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'performResize';"));
|
||||
});
|
||||
|
||||
@ -586,7 +584,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'performLayout without resize';"));
|
||||
});
|
||||
|
||||
@ -609,7 +607,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'StatelessWidget.build';"));
|
||||
});
|
||||
|
||||
@ -637,7 +635,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'StatefulWidget.build';"));
|
||||
});
|
||||
|
||||
@ -669,7 +667,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'dispose';"));
|
||||
});
|
||||
|
||||
@ -717,7 +715,7 @@ void main() {
|
||||
await flutter.test(withDebugger: true, pauseOnExceptions: true);
|
||||
await flutter.waitForPause();
|
||||
|
||||
final int breakLine = (await flutter.getSourceLocation()).line;
|
||||
final int? breakLine = (await flutter.getSourceLocation())?.line;
|
||||
expect(breakLine, project.lineContaining(project.test, "throw 'rebuild';"));
|
||||
});
|
||||
}
|
||||
@ -726,8 +724,8 @@ class TestProject extends Project {
|
||||
TestProject(this.testBody, { this.setup, this.classes });
|
||||
|
||||
final String testBody;
|
||||
final String setup;
|
||||
final String classes;
|
||||
final String? setup;
|
||||
final String? classes;
|
||||
|
||||
@override
|
||||
final String pubspec = '''
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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 'project.dart';
|
||||
|
||||
class BasicProject extends Project {
|
||||
|
@ -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 '../../src/common.dart';
|
||||
import 'deferred_components_config.dart';
|
||||
import 'project.dart';
|
||||
@ -84,7 +82,7 @@ class BasicDeferredComponentsConfig extends DeferredComponentsConfig {
|
||||
''';
|
||||
|
||||
@override
|
||||
String get deferredComponentsGolden => r'''
|
||||
String? get deferredComponentsGolden => r'''
|
||||
loading-units:
|
||||
- id: 2
|
||||
libraries:
|
||||
@ -604,7 +602,7 @@ class NoAndroidDynamicFeatureModuleDeferredComponentsConfig extends BasicDeferre
|
||||
/// Missing golden
|
||||
class NoGoldenDeferredComponentsConfig extends BasicDeferredComponentsConfig {
|
||||
@override
|
||||
String get deferredComponentsGolden => null;
|
||||
String? get deferredComponentsGolden => null;
|
||||
}
|
||||
|
||||
/// Missing golden
|
||||
|
@ -2,10 +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:meta/meta.dart';
|
||||
|
||||
import '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
@ -750,8 +747,8 @@ void main() {
|
||||
''';
|
||||
|
||||
String l10nYaml({
|
||||
@required bool useDeferredLoading,
|
||||
@required bool useSyntheticPackage,
|
||||
required bool useDeferredLoading,
|
||||
required bool useSyntheticPackage,
|
||||
}) {
|
||||
String l10nYamlString = '';
|
||||
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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/file.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
|
@ -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/file.dart';
|
||||
|
||||
import '../test_utils.dart';
|
||||
@ -21,31 +19,32 @@ const String _kDefaultHtml = '''
|
||||
''';
|
||||
|
||||
abstract class Project {
|
||||
Directory dir;
|
||||
late Directory dir;
|
||||
|
||||
String get pubspec;
|
||||
String get main;
|
||||
String get test => null;
|
||||
String get generatedFile => null;
|
||||
DeferredComponentsConfig get deferredComponents => null;
|
||||
String? get main => null;
|
||||
String? get test => null;
|
||||
String? get generatedFile => null;
|
||||
DeferredComponentsConfig? get deferredComponents => null;
|
||||
|
||||
Uri get mainDart => Uri.parse('package:test/main.dart');
|
||||
|
||||
Future<void> setUpIn(Directory dir) async {
|
||||
this.dir = dir;
|
||||
writeFile(fileSystem.path.join(dir.path, 'pubspec.yaml'), pubspec);
|
||||
final String? main = this.main;
|
||||
if (main != null) {
|
||||
writeFile(fileSystem.path.join(dir.path, 'lib', 'main.dart'), main);
|
||||
}
|
||||
final String? test = this.test;
|
||||
if (test != null) {
|
||||
writeFile(fileSystem.path.join(dir.path, 'test', 'test.dart'), test);
|
||||
}
|
||||
final String? generatedFile = this.generatedFile;
|
||||
if (generatedFile != null) {
|
||||
writeFile(fileSystem.path.join(dir.path, '.dart_tool', 'flutter_gen', 'flutter_gen.dart'), generatedFile);
|
||||
}
|
||||
if (deferredComponents != null) {
|
||||
deferredComponents.setUpIn(dir);
|
||||
}
|
||||
deferredComponents?.setUpIn(dir);
|
||||
writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), _kDefaultHtml);
|
||||
writePackages(dir.path);
|
||||
await getPackages(dir.path);
|
||||
|
@ -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 'project.dart';
|
||||
|
||||
class ProjectWithEarlyError extends Project {
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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 '../test_utils.dart';
|
||||
import 'project.dart';
|
||||
|
||||
|
@ -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 'project.dart';
|
||||
|
||||
class SteppingProject extends Project {
|
||||
|
@ -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 'project.dart';
|
||||
|
||||
class TestProject extends Project {
|
||||
|
@ -2,9 +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/file.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user