file.dart icon indicating copy to clipboard operation
file.dart copied to clipboard

WIP: Add a MemoryFileSystemIOOverrides implementation

Open jamesderlin opened this issue 2 years ago • 3 comments
trafficstars

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.current setter is broken when using IOOverrides (https://github.com/dart-lang/sdk/issues/52140). I would not be comfortable suggesting using IOOverrides without a fix.
  • The above bug also leads me to believe that IOOverrides might not be well-tested. Is using IOOverrides an approach that package:file should 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 avatar Apr 23 '23 15:04 jamesderlin

@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?

jakemac53 avatar May 15 '23 15:05 jakemac53

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.

jamesderlin avatar May 15 '23 18:05 jamesderlin

definitely something that I need to help with DCli testing.

bsutton avatar Nov 04 '23 11:11 bsutton

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!

devoncarew avatar Oct 08 '24 17:10 devoncarew