Align flutter pub get/upgrade/add/remove/downgrade (#117896)

* Align `flutter pub get/upgrade/add/remove/downgrade`

* Add final . to command description

* Remove trailing whitespace

* Don't print message that command is being run

* Update expectations

* Use relative path

* Remove duplicated line

* Improve function dartdoc
This commit is contained in:
Sigurd Meldgaard
2023-01-11 00:29:09 +01:00
committed by GitHub
parent cf529ec57e
commit b7881e5b64
12 changed files with 256 additions and 305 deletions

View File

@@ -110,15 +110,8 @@ class FakeCommand {
Map<String, String>? environment,
Encoding? encoding,
) {
expect(command.length, this.command.length);
for(int i = 0; i < command.length; i++) {
final Pattern expected = this.command[i];
if (expected is String) {
expect(command[i], expected);
} else {
expect(command[i], matches(this.command[i]));
}
}
final List<dynamic> matchers = this.command.map((Pattern x) => x is String ? x : matches(x)).toList();
expect(command, matchers);
if (this.workingDirectory != null) {
expect(this.workingDirectory, workingDirectory);
}

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/project.dart';
@@ -21,7 +20,6 @@ class ThrowingPub implements Pub {
Future<void> get({
PubContext? context,
required FlutterProject project,
bool skipIfAbsent = false,
bool upgrade = false,
bool offline = false,
bool checkLastModified = true,
@@ -39,10 +37,12 @@ class ThrowingPub implements Pub {
@override
Future<void> interactively(
List<String> arguments, {
String? directory,
required Stdio stdio,
FlutterProject? project,
required PubContext context,
required String command,
bool touchesPackageConfig = false,
bool generateSyntheticPackage = false,
bool printProgress = true,
}) {
throw UnsupportedError('Attempted to invoke pub during test.');
}