Skip to content

Commit

Permalink
Added test showing presence of SharpZipLib bug.
Browse files Browse the repository at this point in the history
Part of GH KSP-CKAN#221.
  • Loading branch information
pjf committed Oct 31, 2014
1 parent 2a6f5a4 commit 4d71d27
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions CKAN/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Compile Include="NetKAN\KSMod.cs" />
<Compile Include="NetKAN\GitHubTests.cs" />
<Compile Include="CKAN\ModuleInstallDescriptor.cs" />
<Compile Include="ZipLib.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
32 changes: 32 additions & 0 deletions CKAN/Tests/ZipLib.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using NUnit.Framework;
using ICSharpCode.SharpZipLib.Zip;
using System.IO;
using System;

namespace Tests
{
[TestFixture()]
public class ZipLib
{
[Test()]
public void GH221()
{
// This is a perfectly fine file, written by 'file-roller', but
// SharpZipLib can choke on it because it's not properly handling
// the headers properly. See GH #221.
string file = Path.Combine(TestData.DataDir(), "gh221.zip");

var zipfile = new ZipFile(file);

var entry = zipfile.GetEntry("221.txt");

string version = string.Format("{0}", entry.Version);

Assert.DoesNotThrow(delegate
{
zipfile.GetInputStream(entry);
}, "zip-entry format {0} (788 is our bug)", version);
}
}
}

Binary file added t/data/gh221.zip
Binary file not shown.

0 comments on commit 4d71d27

Please sign in to comment.