Replace MockUsage with Usage.test in build tests (#67670)

This commit is contained in:
Jenn Magder
2020-10-08 16:09:49 -07:00
committed by GitHub
parent 41325b5677
commit f92ba2d2c5
7 changed files with 64 additions and 61 deletions

View File

@@ -92,6 +92,18 @@ CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) {
return runner;
}
/// Capture console print events into a string buffer.
Future<StringBuffer> capturedConsolePrint(Future<void> Function() body) async {
final StringBuffer buffer = StringBuffer();
await runZoned<Future<void>>(() async {
// Service the event loop.
await body();
}, zoneSpecification: ZoneSpecification(print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
buffer.writeln(line);
}));
return buffer;
}
/// Matcher for functions that throw [AssertionError].
final Matcher throwsAssertionError = throwsA(isA<AssertionError>());