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
0116b2e7
Unverified
Commit
0116b2e7
authored
May 17, 2022
by
Christopher Fujino
Committed by
GitHub
May 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fix RangeError in flutter channel command (#103766)
parent
2ad7ced9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+4
-0
channel_test.dart
packages/flutter_tools/test/general.shard/channel_test.dart
+32
-0
No files found.
packages/flutter_tools/lib/src/commands/channel.dart
View file @
0116b2e7
...
...
@@ -79,6 +79,10 @@ class ChannelCommand extends FlutterCommand {
for
(
final
String
line
in
rawOutput
)
{
final
List
<
String
>
split
=
line
.
split
(
'/'
);
if
(
split
.
length
!=
2
)
{
// We don't know how to parse this line, skip it.
continue
;
}
final
String
branch
=
split
[
1
];
if
(
split
.
length
>
1
)
{
final
int
index
=
officialChannels
.
indexOf
(
branch
);
...
...
packages/flutter_tools/test/general.shard/channel_test.dart
View file @
0116b2e7
...
...
@@ -136,6 +136,38 @@ void main() {
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
});
testUsingContext
(
'ignores lines with unexpected output'
,
()
async
{
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'git'
,
'branch'
,
'-r'
],
stdout:
'origin/beta
\n
'
'origin/stable
\n
'
'upstream/beta
\n
'
'upstream/stable
\n
'
'foo'
,
),
);
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
]);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
// format the status text for a simpler assertion.
final
Iterable
<
String
>
rows
=
testLogger
.
statusText
.
split
(
'
\n
'
)
.
map
((
String
line
)
=>
line
.
trim
())
.
where
((
String
line
)
=>
line
?.
isNotEmpty
==
true
)
.
skip
(
1
);
// remove `Flutter channels:` line
expect
(
rows
,
<
String
>[
'beta'
,
'stable'
,
'Currently not on an official channel.'
]);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
fakeProcessManager
,
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
});
testUsingContext
(
'removes duplicates'
,
()
async
{
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
...
...
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