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

MockPath.GetFullPath does not match windows behavior. #1044

Open
AnakinRaW opened this issue Oct 8, 2023 · 4 comments
Open

MockPath.GetFullPath does not match windows behavior. #1044

AnakinRaW opened this issue Oct 8, 2023 · 4 comments
Labels
area: testinghelpers Issues that address the testing helpers state: ready to pick Issues that are ready for being worked on type: bug Issues that describe misbehaving functionality

Comments

@AnakinRaW
Copy link

AnakinRaW commented Oct 8, 2023

Describe the bug
In a special case of a rooted, but not absolute path, MockPath.GetFullPath produces results which differ from what i get using System.IO.Path.GetFullPath

To Reproduce

var fs = new MockFileSystem();
Console.WriteLine("Mocking: " + fs.Path.GetFullPath("d:test.txt"));
Console.WriteLine("OS: " + Path.GetFullPath("d:test.txt"));
Output (Linux):
Mocking: /d:test.txt
OS: /home/USER/d:test.txt

Output (Windows):
Mocking: d:test.txt
OS: D:\test.txt

Expected behavior
I expect the values to be equal.

@AnakinRaW AnakinRaW added state: needs discussion Issues that need further discussion type: bug Issues that describe misbehaving functionality labels Oct 8, 2023
@AnakinRaW AnakinRaW changed the title MockPath.GetFullPath does does not match windows behavior. MockPath.GetFullPath does not match windows behavior. Oct 8, 2023
@vbreuss
Copy link
Member

vbreuss commented Oct 9, 2023

@AnakinRaW :
Are you sure, your test is correct?
The provided input "d:test.txt" is no valid (rooted) path. Maybe it should be @"d:\test.txt" instead?

@AnakinRaW
Copy link
Author

AnakinRaW commented Oct 9, 2023

i'm sure my test is correct. even microsoft documented this case in their code comments:
https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/IO/Path.cs#L297

@vbreuss
Copy link
Member

vbreuss commented Oct 10, 2023

Thanks for the clarification, @AnakinRaW !
I was not aware of this format, but after looking around, it is also documented in the File path formats on Windows systems :-)

@fgreinacher
Copy link
Contributor

Wow, what a fancy feature.

@fgreinacher fgreinacher added state: ready to pick Issues that are ready for being worked on area: testinghelpers Issues that address the testing helpers and removed state: needs discussion Issues that need further discussion labels Oct 10, 2023
vbreuss added a commit to Testably/Testably.Abstractions that referenced this issue Oct 11, 2023
…h` (#411)

Support relative paths with drive information in `Path.GetFullPath` as
described in
TestableIO/System.IO.Abstractions#1044.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: testinghelpers Issues that address the testing helpers state: ready to pick Issues that are ready for being worked on type: bug Issues that describe misbehaving functionality
Projects
None yet
Development

No branches or pull requests

3 participants