mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
fix some tests
This commit is contained in:
@@ -38,11 +38,11 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
||||
streams[1].Position = 0;
|
||||
sourceStream.Position = 0;
|
||||
|
||||
return sourceStream.Streams.Select(a => new StreamRarArchiveVolume(a, ReaderOptions));
|
||||
return sourceStream.Streams.Select(a => new StreamRarArchiveVolume(a, ReaderOptions, 1));
|
||||
}
|
||||
else //split mode or single file
|
||||
{
|
||||
return new StreamRarArchiveVolume(sourceStream, ReaderOptions).AsEnumerable();
|
||||
return new StreamRarArchiveVolume(sourceStream, ReaderOptions, 1).AsEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SharpCompress.Archives.Rar;
|
||||
|
||||
internal class StreamRarArchiveVolume : RarVolume
|
||||
{
|
||||
internal StreamRarArchiveVolume(Stream stream, ReaderOptions options, int index = 0)
|
||||
internal StreamRarArchiveVolume(Stream stream, ReaderOptions options, int index)
|
||||
: base(StreamingMode.Seekable, stream, options, index) { }
|
||||
|
||||
internal override IEnumerable<RarFilePart> ReadFileParts() => GetVolumeFileParts();
|
||||
|
||||
@@ -126,7 +126,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
||||
protected override IEnumerable<TarVolume> LoadVolumes(SourceStream sourceStream)
|
||||
{
|
||||
sourceStream.NotNull("SourceStream is null").LoadAllParts(); //request all streams
|
||||
return new TarVolume(sourceStream, ReaderOptions, 0).AsEnumerable(); //simple single volume or split, multivolume not supported
|
||||
return new TarVolume(sourceStream, ReaderOptions, 1).AsEnumerable(); //simple single volume or split, multivolume not supported
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -240,12 +240,10 @@ public class ArchiveTests : ReaderTests
|
||||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
#if !NETFRAMEWORK
|
||||
if (!OperatingSystem.IsWindows())
|
||||
if (!Environment.OSVersion.IsWindows())
|
||||
{
|
||||
fileOrder = fileOrder.Replace('\\', '/');
|
||||
}
|
||||
#endif
|
||||
var expected = new Stack<string>(fileOrder.Split(' '));
|
||||
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
|
||||
using var archive = ArchiveFactory.Open(testArchive, readerOptions);
|
||||
|
||||
8
tests/SharpCompress.Test/OperatingSystemExtensions.cs
Normal file
8
tests/SharpCompress.Test/OperatingSystemExtensions.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace SharpCompress.Test;
|
||||
|
||||
public static class OperatingSystemExtensions
|
||||
{
|
||||
public static bool IsWindows(this OperatingSystem os) => os.Platform == PlatformID.Win32NT || os.Platform == PlatformID.Win32Windows || os.Platform == PlatformID.Win32S;
|
||||
}
|
||||
@@ -77,12 +77,10 @@ public abstract class ReaderTests : TestBase
|
||||
ReaderOptions? options = null
|
||||
)
|
||||
{
|
||||
#if !NETFRAMEWORK
|
||||
if (!OperatingSystem.IsWindows())
|
||||
if (!Environment.OSVersion.IsWindows())
|
||||
{
|
||||
fileOrder = fileOrder.Replace('\\', '/');
|
||||
}
|
||||
#endif
|
||||
var expected = new Stack<string>(fileOrder.Split(' '));
|
||||
|
||||
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
|
||||
|
||||
Reference in New Issue
Block a user