mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This reverts commit c91a3a74ec284c876cc34223444d7385eed241e1.
This commit is contained in:
parent
1d432b8a02
commit
35edbe3d9d
@ -87,7 +87,7 @@ class VersionCommand extends FlutterCommand {
|
||||
}
|
||||
}
|
||||
|
||||
final String version = argResults.rest[0].replaceFirst(RegExp('^v'), '');
|
||||
final String version = argResults.rest[0].replaceFirst('v', '');
|
||||
final List<String> matchingTags = tags.where((String tag) => tag.contains(version)).toList();
|
||||
String matchingTag;
|
||||
// TODO(fujino): make this a tool exit and fix tests
|
||||
|
||||
@ -71,28 +71,6 @@ void main() {
|
||||
FlutterVersion: () => mockVersion,
|
||||
});
|
||||
|
||||
testUsingContext('dev version switch prompt is accepted', () async {
|
||||
when(mockStdio.stdinHasTerminal).thenReturn(true);
|
||||
const String version = '30.0.0-dev.0.0';
|
||||
final VersionCommand command = VersionCommand();
|
||||
when(globals.terminal.promptForCharInput(<String>['y', 'n'],
|
||||
logger: anyNamed('logger'),
|
||||
prompt: 'Are you sure you want to proceed?')
|
||||
).thenAnswer((Invocation invocation) async => 'y');
|
||||
|
||||
await createTestCommandRunner(command).run(<String>[
|
||||
'version',
|
||||
'--no-pub',
|
||||
version,
|
||||
]);
|
||||
expect(testLogger.statusText, contains('Switching Flutter to version $version'));
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => MockProcessManager(),
|
||||
Stdio: () => mockStdio,
|
||||
AnsiTerminal: () => MockTerminal(),
|
||||
FlutterVersion: () => mockVersion,
|
||||
});
|
||||
|
||||
testUsingContext('version switch prompt is declined', () async {
|
||||
when(mockStdio.stdinHasTerminal).thenReturn(true);
|
||||
const String version = '10.0.0';
|
||||
@ -261,7 +239,7 @@ class MockProcessManager extends Mock implements ProcessManager {
|
||||
return ProcessResult(0, 0, 'v10.0.0\r\nv20.0.0\r\n30.0.0-dev.0.0', '');
|
||||
}
|
||||
if (command[0] == 'git' && command[1] == 'checkout') {
|
||||
version = (command[2] as String).replaceFirst(RegExp('^v'), '');
|
||||
version = (command[2] as String).replaceFirst('v', '');
|
||||
}
|
||||
return ProcessResult(0, 0, '', '');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user