Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prefix bug in MockDirectory.EnumerateDirectories (#815) #1046

Merged
merged 8 commits into from
Dec 5, 2023

Conversation

Phoenox
Copy link
Contributor

@Phoenox Phoenox commented Oct 18, 2023

Fixes #815

System.IO.Directory.EnumerateDirectories(path) guarantees that returned paths are always prefixed with the value provided in the path parameter. However, MockDirectory.EnumerateDirectories always returned absolute paths, leading to an inconsistent behavior (e.g. when using relative paths).

We now check returned paths from MockDirectory.EnumerateDirectories and provide the proper prefix path.

`System.IO.Directory.EnumerateDirectories(path)` guarantees that returned paths are always prefixed with the value provided in the `path` parameter. However, `MockDirectory.EnumerateDirectories` always returned absolute paths, leading to an inconsistent behavior (e.g. when using relative paths).

We now check returned paths from `MockDirectory.EnumerateDirectories` and provide the proper prefix path.
Copy link
Member

@vbreuss vbreuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phoenox:
Thanks for this correction, but please make sure, that it also works on Windows, because this library should target all platforms :-)

@Phoenox Phoenox requested a review from vbreuss October 23, 2023 16:18
Copy link
Member

@vbreuss vbreuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 😊
Thanks @Phoenox

@fgreinacher
Copy link
Contributor

Thanks for the fix @Phoenox, please have a look at the failing ubuntu and macOS tests 🙇

@Phoenox
Copy link
Contributor Author

Phoenox commented Nov 15, 2023

@Phoenox, please have a look at the failing ubuntu and macOS tests 🙇

Fixed in cde5f4f

Copy link
Contributor

@fgreinacher fgreinacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Phoenox, this slipped through my notifications. Looks great, thanks a ton for the fix!

@mergify mergify bot merged commit 1d67fb1 into TestableIO:main Dec 5, 2023
9 checks passed
mergify bot referenced this pull request in Testably/Testably.Abstractions Dec 5, 2023
…20 (#432)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[TestableIO.System.IO.Abstractions](https://togithub.com/TestableIO/System.IO.Abstractions)
| `19.2.87` -> `20.0.1` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/TestableIO.System.IO.Abstractions/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/TestableIO.System.IO.Abstractions/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/TestableIO.System.IO.Abstractions/19.2.87/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/TestableIO.System.IO.Abstractions/19.2.87/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>TestableIO/System.IO.Abstractions
(TestableIO.System.IO.Abstractions)</summary>

###
[`v19.2.91`](https://togithub.com/TestableIO/System.IO.Abstractions/releases/tag/v19.2.91)

##### What's Changed

- chore(deps): update dependency saucecontrol.inheritdoc to v1.4.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/TestableIO/System.IO.Abstractions/pull/1057](https://togithub.com/TestableIO/System.IO.Abstractions/pull/1057)
- chore(deps): update dependency moq to v4.20.70 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/TestableIO/System.IO.Abstractions/pull/1059](https://togithub.com/TestableIO/System.IO.Abstractions/pull/1059)
- chore(deps): update actions/setup-dotnet action to v4 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/TestableIO/System.IO.Abstractions/pull/1061](https://togithub.com/TestableIO/System.IO.Abstractions/pull/1061)
- fix: prefix bug in MockDirectory.EnumerateDirectories
([#&#8203;815](https://togithub.com/TestableIO/System.IO.Abstractions/issues/815))
by [@&#8203;Phoenox](https://togithub.com/Phoenox) in
[https://github.com/TestableIO/System.IO.Abstractions/pull/1046](https://togithub.com/TestableIO/System.IO.Abstractions/pull/1046)

##### New Contributors

- [@&#8203;Phoenox](https://togithub.com/Phoenox) made their first
contribution in
[https://github.com/TestableIO/System.IO.Abstractions/pull/1046](https://togithub.com/TestableIO/System.IO.Abstractions/pull/1046)

**Full Changelog**:
TestableIO/System.IO.Abstractions@v19.2.87...v19.2.91

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Testably/Testably.Abstractions).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@Phoenox Phoenox deleted the bugfix/815-relativeDirectoryPaths branch January 14, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MockFileSystem.Directory.GetDirectories returns absolute paths instead of relative paths
3 participants