mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-07-08 18:16:30 +00:00
Add regression test for TarArchive.ExtractAllEntries()
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
@@ -295,4 +295,28 @@ public class TarArchiveTests : ArchiveTests
|
||||
|
||||
Assert.False(isTar);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tar_ExtractAllEntries_ReadsAllEntries()
|
||||
{
|
||||
// Tests that ExtractAllEntries correctly iterates through all entries
|
||||
// This is a regression test for issue #1029
|
||||
var archiveFullPath = Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar");
|
||||
using var archive = TarArchive.Open(archiveFullPath);
|
||||
using var reader = archive.ExtractAllEntries();
|
||||
|
||||
var readEntries = 0;
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
readEntries++;
|
||||
|
||||
if (reader.Entry.IsDirectory)
|
||||
continue;
|
||||
|
||||
using var ms = new MemoryStream();
|
||||
reader.WriteEntryTo(ms);
|
||||
}
|
||||
|
||||
Assert.Equal(archive.Entries.Count, readEntries);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user