Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/SharpCompress.Test/Arc/ArcReaderAsyncTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Threading.Tasks;
using SharpCompress.Common;
using Xunit;

namespace SharpCompress.Test.Arc;

public class ArcReaderAsyncTests : ReaderTests
{
public ArcReaderAsyncTests()
{
UseExtensionInsteadOfNameToVerify = true;
UseCaseInsensitiveToVerify = true;
}

[Fact]
public async Task Arc_Uncompressed_Read_Async() =>
await ReadAsync("Arc.uncompressed.arc", CompressionType.None);

[Fact]
public async Task Arc_Squeezed_Read_Async() => await ReadAsync("Arc.squeezed.arc");

[Fact]
public async Task Arc_Crunched_Read_Async() => await ReadAsync("Arc.crunched.arc");
}
8 changes: 0 additions & 8 deletions tests/SharpCompress.Test/Arc/ArcReaderTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpCompress.Common;
using SharpCompress.Readers;
using SharpCompress.Readers.Arc;
using Xunit;

namespace SharpCompress.Test.Arc
Expand Down
12 changes: 8 additions & 4 deletions tests/SharpCompress.Test/ReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void UseReader(IReader reader)

protected async Task ReadAsync(
string testArchive,
CompressionType expectedCompression,
CompressionType? expectedCompression = null,
ReaderOptions? options = null,
CancellationToken cancellationToken = default
)
Expand All @@ -131,7 +131,7 @@ protected async Task ReadAsync(

private async Task ReadImplAsync(
string testArchive,
CompressionType expectedCompression,
CompressionType? expectedCompression,
ReaderOptions options,
CancellationToken cancellationToken = default
)
Expand All @@ -158,15 +158,19 @@ private async Task ReadImplAsync(

public async Task UseReaderAsync(
IReader reader,
CompressionType expectedCompression,
CompressionType? expectedCompression,
CancellationToken cancellationToken = default
)
{
while (await reader.MoveToNextEntryAsync(cancellationToken))
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(expectedCompression, reader.Entry.CompressionType);
if (expectedCompression.HasValue)
{
Assert.Equal(expectedCompression, reader.Entry.CompressionType);
}

await reader.WriteEntryToDirectoryAsync(
SCRATCH_FILES_PATH,
new ExtractionOptions { ExtractFullPath = true, Overwrite = true },
Expand Down
5 changes: 3 additions & 2 deletions tests/SharpCompress.Test/WriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ await writer.WriteAllAsync(
SharpCompressStream.Create(stream, leaveOpen: true),
readerOptions
);
reader.WriteAllToDirectory(
await reader.WriteAllToDirectoryAsync(
SCRATCH_FILES_PATH,
new ExtractionOptions { ExtractFullPath = true }
new ExtractionOptions { ExtractFullPath = true },
cancellationToken
);
}
VerifyFiles();
Expand Down
Loading