mirror of
https://github.com/flutter/packages.git
synced 2025-06-02 17:20:17 +08:00
[tools] Remove single-example RepositoryPackage method (#5600)
This commit is contained in:
@ -16,7 +16,7 @@ import 'mocks.dart';
|
||||
import 'util.dart';
|
||||
|
||||
void main() {
|
||||
group('$LintAndroidCommand', () {
|
||||
group('LintAndroidCommand', () {
|
||||
FileSystem fileSystem;
|
||||
late Directory packagesDir;
|
||||
late CommandRunner<void> runner;
|
||||
@ -72,6 +72,47 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs on all examples', () async {
|
||||
final List<String> examples = <String>['example1', 'example2'];
|
||||
final Directory pluginDir = createFakePlugin('plugin1', packagesDir,
|
||||
examples: examples,
|
||||
extraFiles: <String>[
|
||||
'example/example1/android/gradlew',
|
||||
'example/example2/android/gradlew',
|
||||
],
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final Iterable<Directory> exampleAndroidDirs = examples.map(
|
||||
(String example) => pluginDir
|
||||
.childDirectory('example')
|
||||
.childDirectory(example)
|
||||
.childDirectory('android'));
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['lint-android']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
for (final Directory directory in exampleAndroidDirs)
|
||||
ProcessCall(
|
||||
directory.childFile('gradlew').path,
|
||||
const <String>['plugin1:lintDebug'],
|
||||
directory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('fails if gradlew is missing', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
@ -89,18 +130,25 @@ void main() {
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Build example before linting'),
|
||||
contains('Build examples before linting'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('fails if linting finds issues', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
final Directory pluginDir =
|
||||
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
|
||||
'example/android/gradlew',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner.mockProcessesForExecutable['gradlew'] = <io.Process>[
|
||||
final String gradlewPath = pluginDir
|
||||
.childDirectory('example')
|
||||
.childDirectory('android')
|
||||
.childFile('gradlew')
|
||||
.path;
|
||||
processRunner.mockProcessesForExecutable[gradlewPath] = <io.Process>[
|
||||
MockProcess(exitCode: 1),
|
||||
];
|
||||
|
||||
@ -115,7 +163,7 @@ void main() {
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Build example before linting'),
|
||||
contains('The following packages had errors:'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
Reference in New Issue
Block a user