reader tests don't pass or make sense

This commit is contained in:
Adam Hathcock
2025-11-26 15:11:03 +00:00
parent d9c9612b8f
commit 8c6d914004
3 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
using System;
using System.IO;
using System.Threading.Tasks;
using SharpCompress.Archives.Zip;
using SharpCompress.Common.Zip.SOZip;
using SharpCompress.Readers;
using SharpCompress.Readers.Zip;
using SharpCompress.Test.Mocks;
using Xunit;
namespace SharpCompress.Test.Zip;
public class SoZipReaderTests : TestBase
{
[Fact]
public async Task SOZip_Reader()
{
var path = Path.Combine(TEST_ARCHIVES_PATH, "foo.zip");
using Stream stream = new ForwardOnlyStream(File.OpenRead(path));
using var reader = ZipReader.Open(stream);
while (await reader.MoveToNextEntryAsync())
{
Assert.True(reader.Entry.IsSozip, $"Entry {reader.Entry.Key} is not SOZip");
if (!reader.Entry.IsDirectory)
{
await reader.WriteEntryToAsync(Stream.Null);
}
}
}
[Fact]
public void SOZip_Archive()
{
var path = Path.Combine(TEST_ARCHIVES_PATH, "foo.zip");
using Stream stream = File.OpenRead(path);
using var archive = ZipArchive.Open(stream);
foreach (var entry in archive.Entries)
{
if (entry.IsSozip)
Console.WriteLine($"{entry.Key} has SOZip random access support");
if (entry.IsSozipIndexFile)
Console.WriteLine($"{entry.Key} is a SOZip index file");
}
}
}

View File

@@ -11,7 +11,7 @@ using Xunit;
namespace SharpCompress.Test.Zip;
public class SOZipTests : TestBase
public class SoZipWriterTests : TestBase
{
[Fact]
public void SOZipIndex_RoundTrip()

Binary file not shown.