Skip to content

Commit 376ca1e

Browse files
author
Simon Ensslen
committed
Fix Unit Tests
1 parent a90e117 commit 376ca1e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ICSharpCode.SharpZipLib/Tar/TarStringExtension.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ internal static class TarStringExtension
66
{
77
public static string ClearTarPath(this string s)
88
{
9-
if (Path.GetPathRoot(s) != null)
9+
var pathRoot = Path.GetPathRoot(s);
10+
if (!string.IsNullOrEmpty(pathRoot))
1011
{
11-
s = s.Substring(Path.GetPathRoot(s).Length);
12+
s = s.Substring(pathRoot.Length);
1213
}
1314
return s.Replace(Path.DirectorySeparatorChar, '/');
1415
}

test/ICSharpCode.SharpZipLib.Tests/Tar/TarTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ public void rootPathIsRespected()
944944
var expectationDirectory = new DirectoryInfo(tempDirectory);
945945
foreach (var checkFile in expectationDirectory.GetFiles("", SearchOption.AllDirectories))
946946
{
947-
var relativePath = expectationDirectory.FullName.Substring(expectationDirectory.FullName.Length);
947+
var relativePath = checkFile.FullName.Substring(expectationDirectory.FullName.Length + 1);
948948
FileAssert.Exists(Path.Combine(extractDirectory, relativePath));
949949
FileAssert.AreEqual(checkFile.FullName, Path.Combine(extractDirectory, relativePath));
950950
}
@@ -954,7 +954,7 @@ private void CreateAndClearDirectory(string path)
954954
{
955955
if (Directory.Exists(path))
956956
{
957-
Directory.Delete(path);
957+
Directory.Delete(path, true);
958958
}
959959
Directory.CreateDirectory(path);
960960
}

0 commit comments

Comments
 (0)