fix tests

This commit is contained in:
Adam Hathcock
2026-02-13 14:22:22 +00:00
parent 7a9c6b56b7
commit 67bbdeab3d
3 changed files with 15 additions and 24 deletions

View File

@@ -1,15 +1,14 @@
using System;
using System.Buffers.Binary;
using System.IO;
using System.Text;
using SharpCompress.Common;
namespace SharpCompress.IO;
internal class MarkingBinaryReader : BinaryReader
internal class MarkingBinaryReader(Stream stream)
: BinaryReader(stream, Encoding.UTF8, leaveOpen: true) //always leave the stream open
{
public MarkingBinaryReader(Stream stream)
: base(stream) { }
public virtual long CurrentReadByteCount { get; protected set; }
public virtual void Mark() => CurrentReadByteCount = 0;

View File

@@ -43,11 +43,9 @@ public class TarArchiveAsyncTests : ArchiveTests
)
using (Stream inputStream = new MemoryStream())
{
using (var sw = new StreamWriter(inputStream))
{
await sw.WriteAsync("dummy filecontent");
await sw.FlushAsync();
}
var sw = new StreamWriter(inputStream);
await sw.WriteAsync("dummy filecontent");
await sw.FlushAsync();
inputStream.Position = 0;
await writer.WriteAsync(filename, inputStream, null);
@@ -104,11 +102,9 @@ public class TarArchiveAsyncTests : ArchiveTests
)
using (Stream inputStream = new MemoryStream())
{
using (var sw = new StreamWriter(inputStream))
{
await sw.WriteAsync("dummy filecontent");
await sw.FlushAsync();
}
var sw = new StreamWriter(inputStream);
await sw.WriteAsync("dummy filecontent");
await sw.FlushAsync();
inputStream.Position = 0;
await writer.WriteAsync(longFilename, inputStream, null);

View File

@@ -54,11 +54,9 @@ public class TarArchiveTests : ArchiveTests
)
using (Stream inputStream = new MemoryStream())
{
using (var sw = new StreamWriter(inputStream))
{
sw.Write("dummy filecontent");
sw.Flush();
}
var sw = new StreamWriter(inputStream);
sw.Write("dummy filecontent");
sw.Flush();
inputStream.Position = 0;
writer.Write(filename, inputStream, null);
@@ -122,11 +120,9 @@ public class TarArchiveTests : ArchiveTests
)
using (Stream inputStream = new MemoryStream())
{
using (var sw = new StreamWriter(inputStream))
{
sw.Write("dummy filecontent");
sw.Flush();
}
var sw = new StreamWriter(inputStream);
sw.Write("dummy filecontent");
sw.Flush();
inputStream.Position = 0;
writer.Write(longFilename, inputStream, null);