Unverified Commit 1884920e authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tool] Handle Windows line endings in packages_test.dart (#63806)

parent 579cab8a
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'package:args/command_runner.dart';
import 'package:flutter_tools/src/base/bot_detector.dart';
......@@ -37,10 +38,14 @@ void main() {
final String projectPath = await createProject(tempDir, arguments: arguments);
final File pubspec = globals.fs.file(globals.fs.path.join(projectPath, 'pubspec.yaml'));
String content = await pubspec.readAsString();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n $plugin:\n',
);
final List<String> contentLines = LineSplitter.split(content).toList();
final int depsIndex = contentLines.indexOf('dependencies:');
expect(depsIndex, isNot(-1));
contentLines.replaceRange(depsIndex, depsIndex + 1, <String>[
'dependencies:',
' $plugin:',
]);
content = contentLines.join('\n');
await pubspec.writeAsString(content, flush: true);
return projectPath;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment