file.dart
file.dart copied to clipboard
WIP: Add a MemoryFileSystemIOOverrides implementation
Add an IOOverrides implementation for MemoryFileSystem. This provides a less invasive mechanism for testing code that uses dart:io directly.
This is a work-in-progress because:
- The tests probably could be more thorough.
- The tests depend on the fix to
FileSystem.isLink(https://github.com/google/file.dart/pull/214). - The
Directory.currentsetter is broken when usingIOOverrides(https://github.com/dart-lang/sdk/issues/52140). I would not be comfortable suggesting usingIOOverrideswithout a fix. - The above bug also leads me to believe that
IOOverridesmight not be well-tested. Is usingIOOverridesan approach thatpackage:fileshould endorse, or would it better in some less-official package?
Before I do more work on this, does anyone have any opinions or feedback?
@jamesderlin did you want to push on this for the 7.x release? Or should we release that now and do this in a follow up?
No, this draft PR is meant just to solicit feedback about whether this is desirable (and if so, whether it should be in package:file or in its own package).
It's not meant to be breaking, so it definitely can wait. I also wouldn't consider it usable until https://github.com/dart-lang/sdk/issues/52140 is fixed.
definitely something that I need to help with DCli testing.
Thanks for the PR! The source-of-truth for this package has moved to https://github.com/dart-lang/tools; we're closing the PRs in this repo. If you believe that this PR is still relevant, feel free to re-create it against the new location. Thanks!