[tool] Replace flutter format (#6946)

`flutter format` is deprecated on `master`, and prints a warning saying
to switch to `dart format` instead. This updates `format` to make that
switch.
This commit is contained in:
stuartmorgan
2023-01-11 14:11:35 -08:00
committed by GitHub
parent d6f71e464c
commit bbab349927
4 changed files with 17 additions and 13 deletions

View File

@ -98,7 +98,7 @@ void main() {
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall(
getFlutterCommand(mockPlatform),
'dart',
<String>['format', ...getPackagesDirRelativePaths(plugin, files)],
packagesDir.path),
]));
@ -132,7 +132,7 @@ void main() {
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall(
getFlutterCommand(mockPlatform),
'dart',
<String>[
'format',
...getPackagesDirRelativePaths(plugin, formattedFiles)
@ -141,7 +141,7 @@ void main() {
]));
});
test('fails if flutter format fails', () async {
test('fails if dart format fails', () async {
const List<String> files = <String>[
'lib/a.dart',
'lib/src/b.dart',
@ -149,8 +149,9 @@ void main() {
];
createFakePlugin('a_plugin', packagesDir, extraFiles: files);
processRunner.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
<io.Process>[MockProcess(exitCode: 1)];
processRunner.mockProcessesForExecutable['dart'] = <io.Process>[
MockProcess(exitCode: 1)
];
Error? commandError;
final List<String> output = await runCapturingPrint(
runner, <String>['format'], errorHandler: (Error e) {
@ -465,7 +466,7 @@ void main() {
],
packagesDir.path),
ProcessCall(
getFlutterCommand(mockPlatform),
'dart',
<String>[
'format',
...getPackagesDirRelativePaths(plugin, dartFiles)
@ -594,7 +595,7 @@ void main() {
processRunner.recordedCalls,
contains(
ProcessCall(
getFlutterCommand(mockPlatform),
'dart',
<String>[
'format',
'$pluginName\\$extraFile',
@ -651,7 +652,7 @@ void main() {
processRunner.recordedCalls,
contains(
ProcessCall(
getFlutterCommand(mockPlatform),
'dart',
<String>[
'format',
'$pluginName/$extraFile',