-
-
Notifications
You must be signed in to change notification settings - Fork 9
fix: trim trailing slash in Directory.GetDirectories
#851
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: trim trailing slash in Directory.GetDirectories
#851
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the Directory.GetDirectories
method to trim trailing slashes from directory paths in the returned results. This ensures consistent behavior where directory paths returned by enumeration methods don't include trailing directory separators.
- Adds helper method
TrimTrailingDirectorySeparator
for consistent path normalization - Updates directory enumeration logic to remove trailing slashes from results
- Includes comprehensive test coverage for both
GetDirectories
andEnumerateDirectories
methods
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs | Adds new test case to verify trailing directory separators are trimmed from results |
Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs | Adds new test case for EnumerateDirectories and fixes code formatting |
Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs | Minor code formatting improvement |
Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs | Updates enumeration logic to trim trailing separators and improves code formatting |
Source/Testably.Abstractions.Testing/Helpers/PathHelper.cs | Adds new helper method for trimming trailing directory separators |
Source/Testably.Abstractions.Testing/FileSystem/DirectoryMock.cs | Applies trailing separator trimming to directory enumeration results |
Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs
Show resolved
Hide resolved
Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
Show resolved
Hide resolved
|
Test Results 37 files ± 0 37 suites ±0 21m 22s ⏱️ -1s Results for commit e6313c4. ± Comparison against base commit f66fee3. This pull request removes 36171 and adds 36189 tests. Note that renamed tests count towards both.
This pull request removes 1784 skipped tests and adds 1788 skipped tests. Note that renamed tests count towards both.
|
This is addressed in release v4.3.4. |
This PR fixes the
Directory.GetDirectories
method to trim trailing slashes from directory paths in the returned results. This ensures consistent behavior where directory paths returned by enumeration methods don't include trailing directory separators.Key changes:
TrimTrailingDirectorySeparator
for consistent path normalizationGetDirectories
andEnumerateDirectories
methods