mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-11-15 17:02:03 +00:00
fixes for release
This commit is contained in:
@@ -92,7 +92,11 @@ public class Lzma2TruncationTests
|
||||
data[i] = Convert.ToByte(TruncatedXzHex.Substring(i * 2, 2), 16);
|
||||
}
|
||||
using var input = new MemoryStream(data);
|
||||
#if LEGACY_DOTNET
|
||||
using var decoder = new XZStream(input);
|
||||
#else
|
||||
await using var decoder = new XZStream(input);
|
||||
#endif
|
||||
if (useAsync)
|
||||
{
|
||||
await Assert.ThrowsAnyAsync<SharpCompressException>(() =>
|
||||
@@ -116,7 +120,11 @@ public class Lzma2TruncationTests
|
||||
await using var archive = await ArchiveFactory.OpenAsyncArchive(input);
|
||||
await foreach (var entry in archive.EntriesAsync)
|
||||
{
|
||||
#if LEGACY_DOTNET
|
||||
using var stream = await entry.OpenEntryStreamAsync(CancellationToken.None);
|
||||
#else
|
||||
await using var stream = await entry.OpenEntryStreamAsync(CancellationToken.None);
|
||||
#endif
|
||||
await Assert.ThrowsAnyAsync<SharpCompressException>(() =>
|
||||
stream.CopyToAsync(Stream.Null, 81920, CancellationToken.None)
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -84,7 +85,7 @@ public class LzmaDictionaryAllocationTests
|
||||
bool useAsync
|
||||
)
|
||||
{
|
||||
using var window = new OutWindow();
|
||||
using var window = new OutWindow(ArrayPool<byte>.Create());
|
||||
window.Create(int.MaxValue);
|
||||
window.SetLimit(int.MaxValue);
|
||||
using var input = new MemoryStream(new byte[] { 1 });
|
||||
@@ -116,7 +117,7 @@ public class LzmaDictionaryAllocationTests
|
||||
[Fact]
|
||||
public void Lzma_Huge_Dictionary_Starts_Small_And_Grows_With_History()
|
||||
{
|
||||
using var window = new OutWindow();
|
||||
using var window = new OutWindow(ArrayPool<byte>.Create());
|
||||
window.Create(int.MaxValue);
|
||||
Assert.InRange(window.BufferCapacity, 1, 4096);
|
||||
Assert.Equal(0, window.GetByte(0));
|
||||
@@ -188,7 +189,7 @@ public class LzmaDictionaryAllocationTests
|
||||
[InlineData(true)]
|
||||
public async Task Lzma_Preset_Dictionary_Does_Not_Allocate_Declared_Window(bool useAsync)
|
||||
{
|
||||
using var window = new OutWindow();
|
||||
using var window = new OutWindow(ArrayPool<byte>.Create());
|
||||
window.Create(int.MaxValue);
|
||||
using var preset = new MemoryStream(new byte[] { 1, 2, 3 });
|
||||
if (useAsync)
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ShrinkAllocationTests
|
||||
[Fact]
|
||||
public void Shrink_Grows_Only_For_Actual_Output()
|
||||
{
|
||||
var pool = ArrayPool<byte>.Shared;
|
||||
var pool = ArrayPool<byte>.Create();
|
||||
var status = HwUnshrink.UnshrinkGrowing(
|
||||
new byte[] { 65, 132, 0 },
|
||||
3,
|
||||
|
||||
Reference in New Issue
Block a user