mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[flutter_tools] ensure ErrorHandlingFileSystem wraps current directory (#66680)
The lack of current directory wrapping was letting some of the already handled errors through Fixes #66675
This commit is contained in:
parent
fd0e223b74
commit
99d0954857
@ -45,6 +45,9 @@ class ErrorHandlingFileSystem extends ForwardingFileSystem {
|
||||
|
||||
final Platform _platform;
|
||||
|
||||
@override
|
||||
Directory get currentDirectory => directory(delegate.currentDirectory);
|
||||
|
||||
@override
|
||||
File file(dynamic path) => ErrorHandlingFile(
|
||||
platform: _platform,
|
||||
|
||||
@ -300,7 +300,6 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
group('throws ToolExit on macOS', () {
|
||||
const int eperm = 1;
|
||||
const int enospc = 28;
|
||||
@ -445,6 +444,24 @@ void main() {
|
||||
expect(mockFile.toString(), isNotNull);
|
||||
expect(fs.file('file').toString(), equals(mockFile.toString()));
|
||||
});
|
||||
|
||||
testWithoutContext('ErrorHandlingDirectory', () {
|
||||
final MockFileSystem mockFileSystem = MockFileSystem();
|
||||
final FileSystem fs = ErrorHandlingFileSystem(
|
||||
delegate: mockFileSystem,
|
||||
platform: const LocalPlatform(),
|
||||
);
|
||||
final MockDirectory mockDirectory = MockDirectory();
|
||||
when(mockFileSystem.directory(any)).thenReturn(mockDirectory);
|
||||
|
||||
expect(mockDirectory.toString(), isNotNull);
|
||||
expect(fs.directory('directory').toString(), equals(mockDirectory.toString()));
|
||||
|
||||
when(mockFileSystem.currentDirectory).thenReturn(mockDirectory);
|
||||
|
||||
expect(fs.currentDirectory.toString(), equals(mockDirectory.toString()));
|
||||
expect(fs.currentDirectory, isA<ErrorHandlingDirectory>());
|
||||
});
|
||||
});
|
||||
|
||||
group('ProcessManager on windows throws tool exit', () {
|
||||
@ -563,7 +580,7 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('ProcessManager on macOS throws tool exit', () {
|
||||
group('ProcessManager on macOS throws tool exit', () {
|
||||
const int enospc = 28;
|
||||
const int eacces = 13;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user