Skip to content

Commit

Permalink
PR icsharpcode#505: Expect ZipEntry clean name test to be positive
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel authored Aug 9, 2020
1 parent 33ab19b commit 96b4d86
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/ICSharpCode.SharpZipLib.Tests/Zip/StreamHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ public void WriteZipStreamWithNoCompression([Values(0, 1, 256)] int contentLengt

[Test]
[Category("Zip")]
[Category("KnownBugs")]
public void ZipEntryFileNameAutoClean()
{
using (var dummyZip = Utils.GetDummyFile(0))
Expand All @@ -295,6 +294,7 @@ public void ZipEntryFileNameAutoClean()
using (var zipOutputStream = new ZipOutputStream(zipFileStream))
using (var inputFileStream = File.OpenRead(inputFile.Filename))
{
// New ZipEntry created with a full file name path as it's name
zipOutputStream.PutNextEntry(new ZipEntry(inputFile.Filename)
{
CompressionMethod = CompressionMethod.Stored,
Expand All @@ -305,11 +305,9 @@ public void ZipEntryFileNameAutoClean()

using (var zf = new ZipFile(dummyZip.Filename))
{
Assert.AreNotEqual(ZipEntry.CleanName(inputFile.Filename), zf[0].Name,
"Entry file name \"{0}\" WAS automatically cleaned, this test should be removed", inputFile.Filename);
// The ZipEntry name should have been automatically cleaned
Assert.AreEqual(ZipEntry.CleanName(inputFile.Filename), zf[0].Name);
}

Assert.Warn("Entry file name \"{0}\" was not automatically cleaned", inputFile.Filename);
}
}

Expand Down

0 comments on commit 96b4d86

Please sign in to comment.