Skip to content

Commit 35edbe3

Browse files
Revert "[flutter_tools] fix version tag v stripping (flutter#55385)" (flutter#55577)
This reverts commit c91a3a7.
1 parent 1d432b8 commit 35edbe3

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

packages/flutter_tools/lib/src/commands/version.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class VersionCommand extends FlutterCommand {
8787
}
8888
}
8989

90-
final String version = argResults.rest[0].replaceFirst(RegExp('^v'), '');
90+
final String version = argResults.rest[0].replaceFirst('v', '');
9191
final List<String> matchingTags = tags.where((String tag) => tag.contains(version)).toList();
9292
String matchingTag;
9393
// TODO(fujino): make this a tool exit and fix tests

packages/flutter_tools/test/commands.shard/hermetic/version_test.dart

+1-23
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ void main() {
7171
FlutterVersion: () => mockVersion,
7272
});
7373

74-
testUsingContext('dev version switch prompt is accepted', () async {
75-
when(mockStdio.stdinHasTerminal).thenReturn(true);
76-
const String version = '30.0.0-dev.0.0';
77-
final VersionCommand command = VersionCommand();
78-
when(globals.terminal.promptForCharInput(<String>['y', 'n'],
79-
logger: anyNamed('logger'),
80-
prompt: 'Are you sure you want to proceed?')
81-
).thenAnswer((Invocation invocation) async => 'y');
82-
83-
await createTestCommandRunner(command).run(<String>[
84-
'version',
85-
'--no-pub',
86-
version,
87-
]);
88-
expect(testLogger.statusText, contains('Switching Flutter to version $version'));
89-
}, overrides: <Type, Generator>{
90-
ProcessManager: () => MockProcessManager(),
91-
Stdio: () => mockStdio,
92-
AnsiTerminal: () => MockTerminal(),
93-
FlutterVersion: () => mockVersion,
94-
});
95-
9674
testUsingContext('version switch prompt is declined', () async {
9775
when(mockStdio.stdinHasTerminal).thenReturn(true);
9876
const String version = '10.0.0';
@@ -261,7 +239,7 @@ class MockProcessManager extends Mock implements ProcessManager {
261239
return ProcessResult(0, 0, 'v10.0.0\r\nv20.0.0\r\n30.0.0-dev.0.0', '');
262240
}
263241
if (command[0] == 'git' && command[1] == 'checkout') {
264-
version = (command[2] as String).replaceFirst(RegExp('^v'), '');
242+
version = (command[2] as String).replaceFirst('v', '');
265243
}
266244
return ProcessResult(0, 0, '', '');
267245
}

0 commit comments

Comments
 (0)