Remove writelnStderr (#16058)

Paying off technical debt...
This commit is contained in:
Todd Volkert
2018-03-29 05:55:32 -07:00
committed by GitHub
parent cab8242f27
commit 2c898f6813
2 changed files with 63 additions and 27 deletions

View File

@@ -30,13 +30,11 @@ void main() {
setUp(() async {
tools.crashFileSystem = new MemoryFileSystem();
tools.writelnStderr = ([_]) { };
setExitFunctionForTests((_) { });
});
tearDown(() {
tools.crashFileSystem = const LocalFileSystem();
tools.writelnStderr = const Stdio().stderr.writeln;
restoreExitFunction();
});
@@ -119,6 +117,8 @@ void main() {
.map((FileSystemEntity e) => e.path).toList();
expect(writtenFiles, hasLength(1));
expect(writtenFiles, contains('flutter_01.log'));
}, overrides: <Type, Generator>{
Stdio: () => const _NoStderr(),
});
});
}
@@ -149,3 +149,50 @@ class _CrashCommand extends FlutterCommand {
fn3();
}
}
class _NoStderr extends Stdio {
const _NoStderr();
@override
IOSink get stderr => const _NoopIOSink();
}
class _NoopIOSink implements IOSink {
const _NoopIOSink();
@override
Encoding get encoding => utf8;
@override
set encoding(_) => throw new UnsupportedError('');
@override
void add(_) {}
@override
void write(_) {}
@override
void writeAll(_, [__]) {}
@override
void writeln([_]) {}
@override
void writeCharCode(_) {}
@override
void addError(_, [__]) {}
@override
Future<dynamic> addStream(_) async {}
@override
Future<dynamic> flush() async {}
@override
Future<dynamic> close() async {}
@override
Future<dynamic> get done async {}
}