Migrate visual_studio_test (#80088)
This commit is contained in:
@@ -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 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/common.dart';
|
||||
@@ -20,7 +18,7 @@ const String kPath1 = '/bar/bin/$kExecutable';
|
||||
const String kPath2 = '/another/bin/$kExecutable';
|
||||
|
||||
void main() {
|
||||
FakeProcessManager fakeProcessManager;
|
||||
late FakeProcessManager fakeProcessManager;
|
||||
|
||||
setUp(() {
|
||||
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
|
||||
@@ -61,7 +59,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
final OperatingSystemUtils utils = createOSUtils(FakePlatform(operatingSystem: 'linux'));
|
||||
expect(utils.which(kExecutable).path, kPath1);
|
||||
expect(utils.which(kExecutable)!.path, kPath1);
|
||||
});
|
||||
|
||||
testWithoutContext('returns all results for whichAll', () async {
|
||||
@@ -131,7 +129,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
final OperatingSystemUtils utils = createOSUtils(FakePlatform(operatingSystem: 'windows'));
|
||||
expect(utils.which(kExecutable).path, kPath1);
|
||||
expect(utils.which(kExecutable)!.path, kPath1);
|
||||
});
|
||||
|
||||
testWithoutContext('returns all results for whichAll', () async {
|
||||
|
||||
@@ -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:flutter_tools/src/base/user_messages.dart';
|
||||
import 'package:flutter_tools/src/doctor_validator.dart';
|
||||
import 'package:flutter_tools/src/linux/linux_doctor.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/memory.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart' show ProcessException;
|
||||
@@ -102,17 +100,17 @@ const List<String> _requirementsBuildTools = <String>[
|
||||
void setMockVswhereResponse(
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
List<String> requiredComponents,
|
||||
List<String> additionalArguments,
|
||||
Map<String, dynamic> response,
|
||||
String responseOverride,
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
List<String>? requiredComponents,
|
||||
List<String>? additionalArguments,
|
||||
Map<String, dynamic>? response,
|
||||
String? responseOverride,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
fileSystem.file(vswherePath).createSync(recursive: true);
|
||||
fileSystem.file(cmakePath).createSync(recursive: true);
|
||||
final String finalResponse = responseOverride
|
||||
?? json.encode(<Map<String, dynamic>>[response]);
|
||||
?? (response != null ? json.encode(<Map<String, dynamic>>[response]) : '');
|
||||
final List<String> requirementArguments = requiredComponents == null
|
||||
? <String>[]
|
||||
: <String>['-requires', ...requiredComponents];
|
||||
@@ -127,7 +125,7 @@ void setMockVswhereResponse(
|
||||
'-utf8',
|
||||
'-latest',
|
||||
...?additionalArguments,
|
||||
...?requirementArguments,
|
||||
...requirementArguments,
|
||||
],
|
||||
stdout: finalResponse,
|
||||
exception: exception,
|
||||
@@ -138,11 +136,11 @@ void setMockVswhereResponse(
|
||||
// Sets whether or not a vswhere query with the required components will
|
||||
// return an installation.
|
||||
void setMockCompatibleVisualStudioInstallation(
|
||||
Map<String, dynamic> response,
|
||||
Map<String, dynamic>? response,
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
setMockVswhereResponse(
|
||||
fileSystem,
|
||||
@@ -159,11 +157,11 @@ void setMockCompatibleVisualStudioInstallation(
|
||||
// Sets whether or not a vswhere query with the required components will
|
||||
// return a pre-release installation.
|
||||
void setMockPrereleaseVisualStudioInstallation(
|
||||
Map<String, dynamic> response,
|
||||
Map<String, dynamic>? response,
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
setMockVswhereResponse(
|
||||
fileSystem,
|
||||
@@ -180,11 +178,11 @@ void setMockPrereleaseVisualStudioInstallation(
|
||||
// Sets whether or not a vswhere query with the required components will
|
||||
// return an Build Tools installation.
|
||||
void setMockCompatibleVisualStudioBuildToolsInstallation(
|
||||
Map<String, dynamic> response,
|
||||
Map<String, dynamic>? response,
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
setMockVswhereResponse(
|
||||
fileSystem,
|
||||
@@ -201,11 +199,11 @@ void setMockCompatibleVisualStudioBuildToolsInstallation(
|
||||
// Sets whether or not a vswhere query with the required components will
|
||||
// return a pre-release Build Tools installation.
|
||||
void setMockPrereleaseVisualStudioBuildToolsInstallation(
|
||||
Map<String, dynamic> response,
|
||||
Map<String, dynamic>? response,
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
setMockVswhereResponse(
|
||||
fileSystem,
|
||||
@@ -222,11 +220,11 @@ void setMockPrereleaseVisualStudioBuildToolsInstallation(
|
||||
// Sets whether or not a vswhere query searching for 'all' and 'prerelease'
|
||||
// versions will return an installation.
|
||||
void setMockAnyVisualStudioInstallation(
|
||||
Map<String, dynamic> response,
|
||||
Map<String, dynamic>? response,
|
||||
FileSystem fileSystem,
|
||||
FakeProcessManager processManager, [
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
int? exitCode,
|
||||
Exception? exception,
|
||||
]) {
|
||||
setMockVswhereResponse(
|
||||
fileSystem,
|
||||
|
||||
Reference in New Issue
Block a user