forked from firka/flutter
[flutter_tool] Catch a yaml parse failure during project creation (#36105)
This commit is contained in:
@@ -40,7 +40,19 @@ void main() {
|
||||
|
||||
expect(
|
||||
() => FlutterProject.fromDirectory(directory),
|
||||
throwsA(isInstanceOf<Exception>()),
|
||||
throwsA(isInstanceOf<ToolExit>()),
|
||||
);
|
||||
});
|
||||
|
||||
testInMemory('fails on pubspec.yaml parse failure', () async {
|
||||
final Directory directory = fs.directory('myproject');
|
||||
directory.childFile('pubspec.yaml')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(parseErrorPubspec);
|
||||
|
||||
expect(
|
||||
() => FlutterProject.fromDirectory(directory),
|
||||
throwsA(isInstanceOf<ToolExit>()),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -52,7 +64,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
() => FlutterProject.fromDirectory(directory),
|
||||
throwsA(isInstanceOf<Exception>()),
|
||||
throwsA(isInstanceOf<ToolExit>()),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -575,6 +587,14 @@ flutter:
|
||||
invalid:
|
||||
''';
|
||||
|
||||
String get parseErrorPubspec => '''
|
||||
name: hello
|
||||
# Whitespace is important.
|
||||
flutter:
|
||||
something:
|
||||
something_else:
|
||||
''';
|
||||
|
||||
String projectFileWithBundleId(String id, {String qualifier}) {
|
||||
return '''
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
|
||||
Reference in New Issue
Block a user