Migrate build system build.dart to null safety (#83381)

This commit is contained in:
Jenn Magder
2021-05-26 12:04:02 -07:00
committed by GitHub
parent 48a2bc8c64
commit 00263c4f8a
8 changed files with 72 additions and 62 deletions

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/build.dart';
@@ -72,22 +70,16 @@ const List<String> kBitcodeClang = <String>[
void main() {
group('SnapshotType', () {
test('throws, if build mode is null', () {
expect(
() => SnapshotType(TargetPlatform.android_x64, null),
throwsA(anything),
);
});
test('does not throw, if target platform is null', () {
expect(() => SnapshotType(null, BuildMode.release), returnsNormally);
});
});
group('GenSnapshot', () {
GenSnapshot genSnapshot;
Artifacts artifacts;
FakeProcessManager processManager;
BufferLogger logger;
late GenSnapshot genSnapshot;
late Artifacts artifacts;
late FakeProcessManager processManager;
late BufferLogger logger;
setUp(() async {
artifacts = Artifacts.test();
@@ -179,10 +171,10 @@ void main() {
});
group('AOTSnapshotter', () {
MemoryFileSystem fileSystem;
AOTSnapshotter snapshotter;
Artifacts artifacts;
FakeProcessManager processManager;
late MemoryFileSystem fileSystem;
late AOTSnapshotter snapshotter;
late Artifacts artifacts;
late FakeProcessManager processManager;
setUp(() async {
fileSystem = MemoryFileSystem.test();

View File

@@ -83,6 +83,24 @@ void main() {
expect(logger.statusText, equals('${testString[0]}\n'));
expect(logger.errorText, equals('${testString[0]}\n'));
});
testWithoutContext('Command output is filtered by mapFunction', () async {
processManager.addCommand(const FakeCommand(
command: <String>['command'],
stdout: 'match\nno match',
stderr: 'match\nno match',
));
await processUtils.stream(<String>['command'], mapFunction: (String line) {
if (line == 'match') {
return line;
}
return null;
});
expect(logger.statusText, equals('match\n'));
expect(logger.errorText, equals('match\n'));
});
});
group('run', () {