Fix crash during artifact download (#14147)
diff --git a/packages/flutter_tools/test/cache_test.dart b/packages/flutter_tools/test/cache_test.dart
index a4ef941..b8fe08a 100644
--- a/packages/flutter_tools/test/cache_test.dart
+++ b/packages/flutter_tools/test/cache_test.dart
@@ -77,6 +77,14 @@
verify(artifact2.update());
});
});
+
+ testUsingContext('flattenNameSubdirs', () {
+ expect(flattenNameSubdirs(Uri.parse('http://flutter.io/foo/bar')), 'flutter.io/foo/bar');
+ expect(flattenNameSubdirs(Uri.parse('http://docs.flutter.io/foo/bar')), 'docs.flutter.io/foo/bar');
+ expect(flattenNameSubdirs(Uri.parse('https://www.flutter.io')), 'www.flutter.io');
+ }, overrides: <Type, Generator>{
+ FileSystem: () => new MockFileSystem(),
+ });
}
class MockFileSystem extends MemoryFileSystem {