mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 08:53:11 +08:00
[various] Clean up obsolete references to "master" (#5912)
This commit is contained in:
@ -27,6 +27,7 @@ String _headerSection(
|
||||
String name, {
|
||||
bool isPlugin = false,
|
||||
bool includeRepository = true,
|
||||
String repositoryBranch = 'main',
|
||||
String? repositoryPackagesDirRelativePath,
|
||||
bool includeHomepage = false,
|
||||
bool includeIssueTracker = true,
|
||||
@ -38,7 +39,7 @@ String _headerSection(
|
||||
'flutter',
|
||||
if (isPlugin) 'plugins' else 'packages',
|
||||
'tree',
|
||||
'main',
|
||||
repositoryBranch,
|
||||
'packages',
|
||||
repositoryPath,
|
||||
];
|
||||
@ -328,7 +329,7 @@ ${_devDependenciesSection()}
|
||||
);
|
||||
});
|
||||
|
||||
test('fails when repository is incorrect', () async {
|
||||
test('fails when repository package name is incorrect', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin', packagesDir, examples: <String>[]);
|
||||
|
||||
@ -355,6 +356,33 @@ ${_devDependenciesSection()}
|
||||
);
|
||||
});
|
||||
|
||||
test('fails when repository uses master instead of main', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin', packagesDir, examples: <String>[]);
|
||||
|
||||
plugin.pubspecFile.writeAsStringSync('''
|
||||
${_headerSection('plugin', isPlugin: true, repositoryBranch: 'master')}
|
||||
${_environmentSection()}
|
||||
${_flutterSection(isPlugin: true)}
|
||||
${_dependenciesSection()}
|
||||
${_devDependenciesSection()}
|
||||
''');
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['pubspec-check'], errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('The "repository" link should use "main", not "master".'),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('fails when issue tracker is missing', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin', packagesDir, examples: <String>[]);
|
||||
|
Reference in New Issue
Block a user