@@ -398,6 +398,30 @@ void main() {
398
398
expect (staleFile, isNot (exists));
399
399
});
400
400
401
+ testWithoutContext ('Try to remove without a parent' , () async {
402
+ final FileSystem fileSystem = MemoryFileSystem .test ();
403
+ final Directory parent = fileSystem.directory ('dir' );
404
+ parent.createSync ();
405
+ final Directory child = parent.childDirectory ('child' );
406
+ child.createSync ();
407
+ final Directory tempStorage = parent.childDirectory ('temp' );
408
+ tempStorage.createSync ();
409
+ final FakeArtifactUpdaterDownload fakeArtifact = FakeArtifactUpdaterDownload (
410
+ operatingSystemUtils: FakeOperatingSystemUtils (),
411
+ logger: BufferLogger .test (),
412
+ fileSystem: fileSystem,
413
+ tempStorage: tempStorage,
414
+ httpClient: HttpClient (),
415
+ platform: FakePlatform (),
416
+ allowedBaseUrls: < String > []
417
+ );
418
+ final File file = child.childFile ('file' );
419
+ file.createSync ();
420
+ fakeArtifact.addFiles (< File > [file]);
421
+ child.deleteSync (recursive: true );
422
+ fakeArtifact.removeDownloadedFiles ();
423
+ });
424
+
401
425
testWithoutContext ('IosUsbArtifacts verifies executables for libimobiledevice in isUpToDateInner' , () async {
402
426
final FileSystem fileSystem = MemoryFileSystem .test ();
403
427
final Cache cache = Cache .test (fileSystem: fileSystem, processManager: FakeProcessManager .any ());
@@ -1212,3 +1236,19 @@ class FakeArtifactUpdater extends Fake implements ArtifactUpdater {
1212
1236
@override
1213
1237
void removeDownloadedFiles () { }
1214
1238
}
1239
+
1240
+ class FakeArtifactUpdaterDownload extends ArtifactUpdater {
1241
+ FakeArtifactUpdaterDownload ({
1242
+ required super .operatingSystemUtils,
1243
+ required super .logger,
1244
+ required super .fileSystem,
1245
+ required super .tempStorage,
1246
+ required super .httpClient,
1247
+ required super .platform,
1248
+ required super .allowedBaseUrls
1249
+ });
1250
+
1251
+ void addFiles (List <File > files) {
1252
+ downloadedFiles.addAll (files);
1253
+ }
1254
+ }
0 commit comments