@@ -171,6 +171,16 @@ dev_dependencies:
171171
172172const invalidPubspec = 'name: example' ;
173173
174+ const unreachableGitUrlPubspec = '''
175+ name: example
176+ environment:
177+ sdk: ">=2.13.0 <3.0.0"
178+
179+ dev_dependencies:
180+ very_good_analysis:
181+ git:
182+ url: https://github.com/verygoodopensource/_very_good_analysis''' ;
183+
174184class MockLogger extends Mock implements Logger {}
175185
176186void main () {
@@ -194,6 +204,17 @@ void main() {
194204 );
195205 });
196206
207+ test ('throws when there is an unreachable git url' , () {
208+ final directory = Directory .systemTemp.createTempSync ();
209+ File (p.join (directory.path, 'pubspec.yaml' ))
210+ .writeAsStringSync (unreachableGitUrlPubspec);
211+
212+ expectLater (
213+ Flutter .packagesGet (cwd: directory.path),
214+ throwsA (isA <UnreachableGitDependency >()),
215+ );
216+ });
217+
197218 test ('completes when there is a pubspec.yaml' , () {
198219 expectLater (Flutter .packagesGet (), completes);
199220 });
@@ -238,6 +259,17 @@ void main() {
238259 );
239260 });
240261
262+ test ('throws when there is an unreachable git url' , () {
263+ final directory = Directory .systemTemp.createTempSync ();
264+ File (p.join (directory.path, 'pubspec.yaml' ))
265+ .writeAsStringSync (unreachableGitUrlPubspec);
266+
267+ expectLater (
268+ Flutter .packagesGet (cwd: directory.path),
269+ throwsA (isA <UnreachableGitDependency >()),
270+ );
271+ });
272+
241273 test ('completes when there is a pubspec.yaml' , () {
242274 final directory = Directory .systemTemp.createTempSync ();
243275 File (p.join (directory.path, 'pubspec.yaml' )).writeAsStringSync (pubspec);
0 commit comments