Skip to content

Comments

Add comprehensive RAR5 async extraction tests#1205

Closed
Copilot wants to merge 3 commits intomasterfrom
copilot/sub-pr-1203
Closed

Add comprehensive RAR5 async extraction tests#1205
Copilot wants to merge 3 commits intomasterfrom
copilot/sub-pr-1203

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

The async RAR5 extraction code path (Unpack5Async) lacked dedicated test coverage to verify it executes correctly vs. falling back to sync methods.

Changes

  • New test suite: Rar5AsyncExtractionTests with 12 tests covering:

    • Basic and solid archive extraction
    • Encrypted archives (header+files, files-only)
    • Special formats (Blake2 CRC, comments, uncompressed)
    • Multiple extraction methods (ExtractAllEntries, WriteToDirectory, OpenEntryStream)
    • Entry skipping in solid archives
  • Async enforcement: All tests use AsyncOnlyStream wrapper that throws on synchronous Read operations, ensuring async code paths execute rather than sync fallbacks

// AsyncOnlyStream forces async execution
using var stream = File.OpenRead("Rar5.solid.rar");
await using var reader = await ReaderFactory.OpenAsyncReader(new AsyncOnlyStream(stream));

while (await reader.MoveToNextEntryAsync())
{
    if (!reader.Entry.IsDirectory)
    {
        await reader.WriteEntryToDirectoryAsync(outputPath);
    }
}

All tests pass on net48 and net10.0.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 16:56
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- Created Rar5AsyncExtractionTests with 12 tests that exercise Unpack5Async code path
- Tests use AsyncOnlyStream to ensure async methods are called (not sync fallbacks)
- Cover basic archives, solid archives, encrypted archives, and various extraction methods
- Tests verify:
  * ExtractAllEntries for solid archives
  * Individual file extraction with WriteEntryToDirectoryAsync
  * OpenEntryStream for manual extraction
  * WriteToDirectory for full archive extraction
  * Encrypted files (both header+files and files only)
  * Special formats (Blake2 CRC, comments, uncompressed)
  * Skipping entries in solid archives
- All tests passing on both net48 and net10.0

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot AI changed the title [WIP] Add RAR tests for Unpack5Async code path Add comprehensive RAR5 async extraction tests Feb 11, 2026
Copilot AI requested a review from adamhathcock February 11, 2026 17:04
Base automatically changed from adam/issue-1201 to master February 11, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants