[flutter_test] handle breaking change to test main (#67425)
* [flutter_test] handle breaking change to test main . Fixes #67382
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
export 'package:flutter_goldens/flutter_goldens.dart' show main;
|
||||
export 'package:flutter_goldens/flutter_goldens.dart' show testExecutable;
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
export 'package:flutter_goldens/flutter_goldens.dart' show main;
|
||||
export 'package:flutter_goldens/flutter_goldens.dart' show testExecutable;
|
||||
|
||||
@@ -27,7 +27,7 @@ const String _kFlutterRootKey = 'FLUTTER_ROOT';
|
||||
/// [goldenFileComparator] to an instance of [FlutterGoldenFileComparator] that
|
||||
/// works for the current test. _Which_ FlutterGoldenFileComparator is
|
||||
/// instantiated is based on the current testing environment.
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
const Platform platform = LocalPlatform();
|
||||
if (FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform)) {
|
||||
goldenFileComparator = await FlutterPostSubmitFileComparator.fromDefaultComparator(platform);
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
reportTestException = (FlutterErrorDetails details, String testDescription) {
|
||||
expect(details.exception, isA<StateError>());
|
||||
expect((details.exception as StateError).message, 'foo');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
await runZoned<dynamic>(testMain, zoneValues: <Type, String>{
|
||||
String: '/test_config',
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
await runZoned<dynamic>(testMain, zoneValues: <Type, dynamic>{
|
||||
String: '/test_config/nested_config',
|
||||
int: 123,
|
||||
|
||||
@@ -197,7 +197,7 @@ void main() {
|
||||
''');
|
||||
if (testConfigFile != null) {
|
||||
buffer.write('''
|
||||
return () => test_config.main(test.main);
|
||||
return () => test_config.testExecutable(test.main);
|
||||
''');
|
||||
} else {
|
||||
buffer.write('''
|
||||
|
||||
@@ -956,7 +956,7 @@ void main() async {
|
||||
LocalFileComparator comparator = LocalFileComparator(Uri.parse('$testUri'));
|
||||
goldenFileComparator = comparator;
|
||||
|
||||
${testConfigFile != null ? 'test_config.main(() async {' : ''}
|
||||
${testConfigFile != null ? 'test_config.testExecutable(() async {' : ''}
|
||||
final commands = stdin
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
|
||||
Reference in New Issue
Block a user