Extract KernelCompiler class (#16937)

Wraps the compile function in a class injected via the global context,
which makes it easier to mock in unit tests -- specifically tests for
AOT snapshotting, which already require pretty significant amounts of
mock inputs.
This commit is contained in:
Chris Bracken
2018-04-24 14:03:41 -07:00
committed by GitHub
parent a21c93dd70
commit 7ffcd3d22d
5 changed files with 85 additions and 76 deletions

View File

@@ -46,7 +46,7 @@ void main() {
'result abc\nline1\nline2\nabc /path/to/main.dart.dill 0'
))
));
final CompilerOutput output = await compile(sdkRoot: '/path/to/sdkroot',
final CompilerOutput output = await kernelCompiler.compile(sdkRoot: '/path/to/sdkroot',
mainPath: '/path/to/main.dart'
);
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
@@ -66,7 +66,7 @@ void main() {
))
));
final CompilerOutput output = await compile(sdkRoot: '/path/to/sdkroot',
final CompilerOutput output = await kernelCompiler.compile(sdkRoot: '/path/to/sdkroot',
mainPath: '/path/to/main.dart'
);
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
@@ -88,7 +88,7 @@ void main() {
))
));
final CompilerOutput output = await compile(sdkRoot: '/path/to/sdkroot',
final CompilerOutput output = await kernelCompiler.compile(sdkRoot: '/path/to/sdkroot',
mainPath: '/path/to/main.dart'
);
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);