Skip to content

Add Path.AreEqual static extension method - #88

Merged
Tyrrrz merged 3 commits into
primefrom
copilot/path-static-extension-method
Jul 16, 2026
Merged

Add Path.AreEqual static extension method#88
Tyrrrz merged 3 commits into
primefrom
copilot/path-static-extension-method

Conversation

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Adds a Path.AreEqual static extension method for comparing two paths for equality, which was missing from the PathExtensions class.

Changes

  • PathExtensions.cs — new Path.AreEqual(string?, string?) method that:
    • Normalizes both paths via Path.GetFullPath + Path.TrimEndingDirectorySeparator (handles ./.. segments and trailing separators)
    • Uses OrdinalIgnoreCase on Windows, Ordinal elsewhere
    • Handles null inputs (both null → true, one null → false)
  • PathExtensionsTests.cs — tests covering null handling, trailing slashes, and path normalization

Example

Path.AreEqual("/foo/bar/", "/foo/bar")          // true
Path.AreEqual("/foo/./baz/../bar", "/foo/bar")  // true
Path.AreEqual("/foo/bar", "/foo/baz")           // false
Path.AreEqual(null, null)                       // true

@Tyrrrz Tyrrrz added the enhancement New feature or request label Jul 16, 2026
@Tyrrrz
Tyrrrz marked this pull request as ready for review July 16, 2026 12:51
Copilot AI review requested due to automatic review settings July 16, 2026 12:51
Comment thread PowerKit/Extensions/PathExtensions.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a Path.AreEqual(string?, string?) static extension member to the existing PathExtensions extension block, providing a normalized, OS-aware path equality check (case-insensitive on Windows, case-sensitive elsewhere), and introduces unit tests for the new API.

Changes:

  • Added Path.AreEqual(string?, string?) that normalizes inputs via Path.GetFullPath + Path.TrimEndingDirectorySeparator before comparing.
  • Added unit tests for null handling and basic normalization cases (trailing separators, . / .. segments).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PowerKit/Extensions/PathExtensions.cs Adds Path.AreEqual implementation with normalization + OS-specific string comparison.
PowerKit.Tests/Extensions/PathExtensionsTests.cs Adds tests for the new Path.AreEqual API behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit.Tests/Extensions/PathExtensionsTests.cs
Copilot AI requested a review from Tyrrrz July 16, 2026 12:58
Comment thread PowerKit/Extensions/PathExtensions.cs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI requested a review from Tyrrrz July 16, 2026 13:07
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.35%. Comparing base (914841c) to head (1ceaa6b).

Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #88      +/-   ##
==========================================
+ Coverage   86.25%   86.35%   +0.09%     
==========================================
  Files          74       74              
  Lines        1244     1253       +9     
  Branches      231      234       +3     
==========================================
+ Hits         1073     1082       +9     
  Misses        121      121              
  Partials       50       50              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants