Skip to content

Commit

Permalink
Add missing test to ensure correct behaviour for Path.GetFullPath whe…
Browse files Browse the repository at this point in the history
…n providing `"."`
  • Loading branch information
vbreuss committed Oct 10, 2023
1 parent 5d5fec9 commit 74afb7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override string GetFullPath(string path)

string? pathRoot = Path.GetPathRoot(path);
string? directoryRoot = Path.GetPathRoot(_fileSystem.Storage.CurrentDirectory);
if (pathRoot != null && directoryRoot != null)
if (!string.IsNullOrEmpty(pathRoot) && !string.IsNullOrEmpty(directoryRoot))
{
if (pathRoot[0] != directoryRoot[0])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ public void GetFullPath_RelativePathWithDrive_ShouldReturnExpectedValue()
result.Should().Be(expectedFullPath);
}

[SkippableFact]
public void GetFullPath_Dot_ShouldReturnToCurrentDirectory()
{
string expectedFullPath = FileSystem.Directory.GetCurrentDirectory();

string result = FileSystem.Path.GetFullPath(".");

result.Should().Be(expectedFullPath);
}

[SkippableFact]
public void
GetFullPath_RelativePathWithDrive_WhenCurrentDirectoryIsDifferent_ShouldReturnExpectedValue()
Expand Down

0 comments on commit 74afb7a

Please sign in to comment.