Fix compile expression in tests when precompiled dill files are used. (#84470)

This commit is contained in:
Lau Ching Jun
2021-06-14 13:44:03 -07:00
committed by GitHub
parent 7773d0b020
commit acd68cf47b
3 changed files with 58 additions and 18 deletions

View File

@@ -59,6 +59,23 @@ void main() {
Logger: () => BufferLogger.test(),
});
testUsingContext('TestCompiler does not try to cache the dill file when precompiled dill is passed', () async {
residentCompiler.compilerOutput = const CompilerOutput('abc.dill', 0, <Uri>[]);
final FakeTestCompiler testCompiler = FakeTestCompiler(
debugBuild,
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
residentCompiler,
precompiledDillPath: 'precompiled.dill',
);
expect(await testCompiler.compile(Uri.parse('test/foo.dart')), 'abc.dill');
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
Platform: () => linuxPlatform,
ProcessManager: () => FakeProcessManager.any(),
Logger: () => BufferLogger.test(),
});
testUsingContext('TestCompiler reports null when a compile fails', () async {
residentCompiler.compilerOutput = const CompilerOutput('abc.dill', 1, <Uri>[]);
final FakeTestCompiler testCompiler = FakeTestCompiler(
@@ -103,8 +120,10 @@ class FakeTestCompiler extends TestCompiler {
FakeTestCompiler(
BuildInfo buildInfo,
FlutterProject flutterProject,
this.residentCompiler,
) : super(buildInfo, flutterProject);
this.residentCompiler, {
String precompiledDillPath,
}
) : super(buildInfo, flutterProject, precompiledDillPath: precompiledDillPath);
final FakeResidentCompiler residentCompiler;