Unverified Commit 8b139a8c authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tool] Use the delegate's toString in the ErrorHandlingFileSystem (#48597)

parent 67a68e9f
......@@ -52,6 +52,9 @@ class ErrorHandlingFileSystem extends ForwardingFileSystem {
_cachedPath = null;
delegate.currentDirectory = path;
}
@override
String toString() => delegate.toString();
}
class ErrorHandlingFile
......@@ -141,6 +144,9 @@ class ErrorHandlingFile
);
}
@override
String toString() => delegate.toString();
Future<T> _run<T>(Future<T> Function() op, { String failureMessage }) async {
try {
return await op();
......@@ -230,6 +236,9 @@ class ErrorHandlingDirectory
@override
Link childLink(String basename) =>
wrapLink(fileSystem.directory(delegate).childLink(basename));
@override
String toString() => delegate.toString();
}
class ErrorHandlingLink
......@@ -254,4 +263,7 @@ class ErrorHandlingLink
@override
Link wrapLink(io.Link delegate) =>
ErrorHandlingLink(fileSystem, delegate);
@override
String toString() => delegate.toString();
}
......@@ -118,4 +118,24 @@ void main() {
expect(identical(firstPath, fs.path), false);
});
group('toString() gives toString() of delegate', () {
test('ErrorHandlingFileSystem', () {
final MockFileSystem mockFileSystem = MockFileSystem();
final FileSystem fs = ErrorHandlingFileSystem(mockFileSystem);
expect(mockFileSystem.toString(), isNotNull);
expect(fs.toString(), equals(mockFileSystem.toString()));
});
test('ErrorHandlingFile', () {
final MockFileSystem mockFileSystem = MockFileSystem();
final FileSystem fs = ErrorHandlingFileSystem(mockFileSystem);
final MockFile mockFile = MockFile();
when(mockFileSystem.file(any)).thenReturn(mockFile);
expect(mockFile.toString(), isNotNull);
expect(fs.file('file').toString(), equals(mockFile.toString()));
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment