@@ -136,6 +136,38 @@ void main() {
136
136
FileSystem : () => MemoryFileSystem .test (),
137
137
});
138
138
139
+ testUsingContext ('ignores lines with unexpected output' , () async {
140
+ fakeProcessManager.addCommand (
141
+ const FakeCommand (
142
+ command: < String > ['git' , 'branch' , '-r' ],
143
+ stdout: 'origin/beta\n '
144
+ 'origin/stable\n '
145
+ 'upstream/beta\n '
146
+ 'upstream/stable\n '
147
+ 'foo' ,
148
+ ),
149
+ );
150
+
151
+ final ChannelCommand command = ChannelCommand ();
152
+ final CommandRunner <void > runner = createTestCommandRunner (command);
153
+ await runner.run (< String > ['channel' ]);
154
+
155
+ expect (fakeProcessManager.hasRemainingExpectations, isFalse);
156
+ expect (testLogger.errorText, hasLength (0 ));
157
+
158
+ // format the status text for a simpler assertion.
159
+ final Iterable <String > rows = testLogger.statusText
160
+ .split ('\n ' )
161
+ .map ((String line) => line.trim ())
162
+ .where ((String line) => line? .isNotEmpty == true )
163
+ .skip (1 ); // remove `Flutter channels:` line
164
+
165
+ expect (rows, < String > ['beta' , 'stable' , 'Currently not on an official channel.' ]);
166
+ }, overrides: < Type , Generator > {
167
+ ProcessManager : () => fakeProcessManager,
168
+ FileSystem : () => MemoryFileSystem .test (),
169
+ });
170
+
139
171
testUsingContext ('removes duplicates' , () async {
140
172
fakeProcessManager.addCommand (
141
173
const FakeCommand (
0 commit comments