[flutter_tool] Use the delegate's toString in the ErrorHandlingFileSystem (#48597)
This commit is contained in:
@@ -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()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user