Scan assets from disk (#16413)
Scan folders when asset specified finishes with `/`
diff --git a/packages/flutter_tools/test/flutter_manifest_test.dart b/packages/flutter_tools/test/flutter_manifest_test.dart
index dca198a..75be31c 100644
--- a/packages/flutter_tools/test/flutter_manifest_test.dart
+++ b/packages/flutter_tools/test/flutter_manifest_test.dart
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'package:file/file.dart';
+import 'package:file/memory.dart';
+import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/flutter_manifest.dart';
-
import 'package:test/test.dart';
import 'src/common.dart';
@@ -358,4 +360,64 @@
expect(flutterManifest.isEmpty, false);
});
});
+
+ group('FlutterManifest with MemoryFileSystem', () {
+ void assertSchemaIsReadable() async {
+ const String manifest = '''
+name: test
+dependencies:
+ flutter:
+ sdk: flutter
+flutter:
+''';
+
+ final FlutterManifest flutterManifest = await FlutterManifest
+ .createFromString(manifest);
+ expect(flutterManifest.isEmpty, false);
+ }
+
+ void writeSchemaFile(FileSystem filesystem, String schemaData) {
+ final String schemaPath = buildSchemaPath(filesystem);
+ final File schemaFile = filesystem.file(schemaPath);
+
+ final String schemaDir = buildSchemaDir(filesystem);
+
+ filesystem.directory(schemaDir).createSync(recursive: true);
+ filesystem.file(schemaFile).writeAsStringSync(schemaData);
+ }
+
+ void testUsingContextAndFs(String description, FileSystem filesystem,
+ dynamic testMethod()) {
+ const String schemaData = '{}';
+
+ testUsingContext(description,
+ () async {
+ writeSchemaFile( filesystem, schemaData);
+ testMethod();
+ },
+ overrides: <Type, Generator>{
+ FileSystem: () => filesystem,
+ }
+ );
+ }
+
+ testUsingContext('Validate manifest on original fs', () async {
+ assertSchemaIsReadable();
+ });
+
+ testUsingContextAndFs('Validate manifest on Posix FS',
+ new MemoryFileSystem(style: FileSystemStyle.posix), () async {
+ assertSchemaIsReadable();
+ }
+ );
+
+ testUsingContextAndFs('Validate manifest on Windows FS',
+ new MemoryFileSystem(style: FileSystemStyle.windows), () async {
+ assertSchemaIsReadable();
+ }
+ );
+
+ });
+
}
+