Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c91a3a74
Unverified
Commit
c91a3a74
authored
Apr 24, 2020
by
Peter Lauri
Committed by
GitHub
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fix version tag `v` stripping (#55385)
parent
2f0d41b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
version.dart
packages/flutter_tools/lib/src/commands/version.dart
+1
-1
version_test.dart
...tter_tools/test/commands.shard/hermetic/version_test.dart
+23
-1
No files found.
packages/flutter_tools/lib/src/commands/version.dart
View file @
c91a3a74
...
...
@@ -87,7 +87,7 @@ class VersionCommand extends FlutterCommand {
}
}
final
String
version
=
argResults
.
rest
[
0
].
replaceFirst
(
'v'
,
''
);
final
String
version
=
argResults
.
rest
[
0
].
replaceFirst
(
RegExp
(
'^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
...
...
packages/flutter_tools/test/commands.shard/hermetic/version_test.dart
View file @
c91a3a74
...
...
@@ -71,6 +71,28 @@ 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'
;
...
...
@@ -239,7 +261,7 @@ class MockProcessManager extends Mock implements ProcessManager {
return
ProcessResult
(
0
,
0
,
'v10.0.0
\r\n
v20.0.0
\r\n
30.0.0-dev.0.0'
,
''
);
}
if
(
command
[
0
]
==
'git'
&&
command
[
1
]
==
'checkout'
)
{
version
=
(
command
[
2
]
as
String
).
replaceFirst
(
'v'
,
''
);
version
=
(
command
[
2
]
as
String
).
replaceFirst
(
RegExp
(
'^v'
)
,
''
);
}
return
ProcessResult
(
0
,
0
,
''
,
''
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment