Unverified Commit 35edbe3d authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "[flutter_tools] fix version tag `v` stripping (#55385)" (#55577)

This reverts commit c91a3a74.
parent 1d432b8a
......@@ -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, '', '');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment