Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #563 from adamhathcock/add-reader-test-gzip
Fix Rewindable stream Length and add GZip Reader tests
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.IO; | ||
using SharpCompress.Common; | ||
using SharpCompress.IO; | ||
using Xunit; | ||
|
||
namespace SharpCompress.Test.GZip | ||
{ | ||
public class GZipReaderTests : ReaderTests | ||
{ | ||
public GZipReaderTests() | ||
{ | ||
UseExtensionInsteadOfNameToVerify = true; | ||
} | ||
|
||
[Fact] | ||
public void GZip_Reader_Generic() | ||
{ | ||
Read("Tar.tar.gz", CompressionType.GZip); | ||
} | ||
|
||
|
||
[Fact] | ||
public void GZip_Reader_Generic2() | ||
{ | ||
//read only as GZip itme | ||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"))) | ||
using (var reader = SharpCompress.Readers.GZip.GZipReader.Open(new RewindableStream(stream))) | ||
{ | ||
while (reader.MoveToNextEntry()) // Crash here | ||
{ | ||
Assert.NotEqual(0, reader.Entry.Size); | ||
Assert.NotEqual(0, reader.Entry.Crc); | ||
} | ||
} | ||
} | ||
} | ||
} |